from mpl_toolkits import mplot3d
import pandas as pd
import numpy as np
import numpy.random
import matplotlib.pyplot as plt
import pickle
from math import gamma
"""self_norm_sum, self_norm_sum_ast, beta_n, sigma_n, alpha_n, rho_n, max_p(sn_2), min_p(sn_2), beta"""
import time
import concurrent.futures
import random
import os
from scipy.linalg import toeplitz # to generate toeplitz matrix
def cov_toep(s, q):
"""A function that takes the dependency thresholds $s$
and the dimension $q$ and returns a qxq-toeplitz matrix.
"""
row = np.array([])
for k in range(q):
row = np.append(row, float(s**k))
return toeplitz(row, row)
def scalar(A,B):
"""Takes two symmetric matrices A and B of sizes q
and returns the modified frobenius scalar of A and B
"""
return(np.trace(A.dot(np.transpose(B)))/A.shape[0])
def norm(A):
"""Takes a symmetric matrix A of sizes q
and returns the norm of A
This norm is associated to the modified frobenius scalar
"""
return np.sqrt(scalar(A,A))
def max_p(M):
"""Largest eigenvalue of a given matrix M"""
val_p = np.linalg.eigvals(M)
return max(val_p.real)
def min_p(M):
"""Smallest eigenvalue of a given matrix M that is not null"""
val_p = np.linalg.eigvals(M)
val_p = val_p[val_p>=10**-6]
return min(val_p.real)
def alphaaa1(S_2):
q = len(S_2)
I_q = np.diag(np.ones(q))
sigma2 = scalar(S_2,I_q)
alpha2 = norm(S_2 - sigma2*I_q)**2
return alpha2
def alphaaa2(vec):
q = len(vec)
I_q = np.diag(np.ones(q))
S_2 = np.diag(vec)
sigma2 = scalar(S_2,I_q)
alpha2 = norm(S_2 - sigma2*I_q)**2
return alpha2
q_list = list(pickle.load(open("q_list", "rb")))
n_list = list(pickle.load(open("n_list", "rb")))
def bounding(n, t):
return (2*np.exp(3)/9)*((t-n)/2)**(n/2)*np.exp(-(t-n)/2)/gamma((n/2)+1)
bnd_dict = {}
for n in n_list:
bnd_dict[n] = lambda x : bounding(n, x)
vp_i_d06 = pickle.load(open("vp_collection_d06", "rb"))
vp_i_d099 = pickle.load(open("vp_collection_d099", "rb"))
vp_i_d0999999 = pickle.load(open("vp_collection_d0999999", "rb"))
data_i_d06 = pickle.load(open("data_vp_collection_d06", "rb"))
data_i_d099 = pickle.load(open("data_vp_collection_d099", "rb"))
data_i_d0999999 = pickle.load(open("data_vp_collection_d0999999", "rb"))
data_id = pickle.load(open("data_vp_collection_id", "rb"))
data_d06 = pickle.load(open("data_d_s0.6", "rb"))
data_d099 = pickle.load(open("data_d_s0.99", "rb"))
data_d0999999 = pickle.load(open("data_d_s0.999999", "rb"))
q_list = list(pickle.load(open("q_list", "rb")))
n_list = list(pickle.load(open("n_list", "rb")))
def indep_sig(alpha):
return np.sqrt(np.log(1+np.sqrt(1+4*alpha**2))-np.log(2))
[alphaaa2(i) for i in vp_i_d06]
[1.0998542783909298, 1.1041153802339447, 1.1011677773544855, 1.101184319828868, 1.098411455272186, 1.100177102223051, 1.1000248846885816, 1.1129641693672463]
[alphaaa1(cov_toep(0.6,q)) for q in q_list]
[1.0898437500000002, 1.107421875, 1.1132812499999998, 1.1162109374999998, 1.1179687499999995, 1.119140625, 1.1199776785714288, 1.1206054687499998]
[alphaaa1(cov_toep(0.99,q)) for q in q_list]
[35.74129922798838, 55.63558896635379, 67.1216545130768, 74.1974025217765, 78.83310482926932, 82.04261087020382, 84.37246235469037, 86.13181245597147]
2*(np.exp( 0.7332754087637589**2)-1)*np.exp(0.73**2)*8
19.411871348368834
[indep_sig(alphaaa2(i)) for i in vp_i_d06]
[0.7317265589292161, 0.7332754087637589, 0.7322046121951515, 0.7322106293951907, 0.7312008040493033, 0.7318441028763617, 0.7317886828210213, 0.7364734922766674]
[indep_sig(alphaaa2(i)) for i in vp_i_d099]
[1.8953306166409798, 2.0063635689876516, 2.0529308230344996, 2.0763534131710575, 2.090988001441459, 2.100851551319377, 2.1074499825951847, 2.1127144072175033]
[alphaaa2(i) for i in vp_i_d099]
[35.81322639270601, 55.5057610930806, 67.16015515618975, 74.03142454338604, 78.71857289577437, 82.06276498069886, 84.38759586673962, 86.29469286163241]
min(1/vp_i_d06[0][:3])
0.5976256525938477
k3_i_d06 = [max(1/min(i),max(i)) for i in vp_i_d06]
k3_i_d06
[6.297944913066576, 7.031366913635838, 8.522439455031826, 7.145883790959295, 8.930530357270474, 7.2958386986887795, 7.136063413616894, 8.21215575890979]
k3_d06 = [max(1/min_p(cov_toep(0.6,q)),max_p(cov_toep(0.6,q))) for q in q_list]
k3_d06
[3.996336838160397, 3.9990794093675825, 3.9995901488211545, 3.9997692631051005, 3.999852253522595, 3.999897363692014, 3.9999245756079675, 3.9999422428030087]
[alphaaa2(i) for i in vp_i_d06]
[1.0998542783909298, 1.1041153802339447, 1.1011677773544855, 1.101184319828868, 1.098411455272186, 1.100177102223051, 1.1000248846885816, 1.1129641693672463]
[indep_sig(alphaaa2(i)) for i in vp_i_d06]
[0.712685614382832, 0.7134583239199866, 0.7129241147244795, 0.7129271166817317, 0.7124233123444276, 0.7127442572214224, 0.7127166081008991, 0.7150537385237915]
[alphaaa1(cov_toep(0.1,q)) for q in q_list]
[0.01979389858177737, 0.019997959391898783, 0.020065979661939255, 0.020099989796959497, 0.020120395877971636, 0.020133999931979736, 0.020143717113414086, 0.020151004999489845]
[alphaaa1(cov_toep(0.6,q)) for q in q_list]
[1.0898437500000002, 1.107421875, 1.1132812499999998, 1.1162109374999998, 1.1179687499999995, 1.119140625, 1.1199776785714288, 1.1206054687499998]
k3_i_d099 = [max(1/min(i),max(i)) for i in vp_i_d099]
k3_i_d099
[43.02066942501199, 52.920497735893626, 96.5503259088677, 79.89846075305199, 95.73064730431038, 126.67039012629309, 130.36265438466427, 102.32122587158783]
[indep_sig(alphaaa2(i)) for i in vp_i_d0999999]
[1.4204411273642101, 1.5321302335984812, 1.5939299574814578, 1.6370821334370564, 1.6702493384061017, 1.6966872204620564, 1.718259521457966, 1.737286825059542]
k3_d099 = [max(1/min_p(cov_toep(0.99,q)),max_p(cov_toep(0.99,q))) for q in q_list]
k3_d099
[198.80370389506928, 198.95090893008816, 198.97818001880813, 198.98772585868846, 198.99214441245965, 198.99454467239042, 198.99599197531322, 198.99693134025188]
[alphaaa2(i) for i in vp_i_d099]
[35.81322639270601, 55.5057610930806, 67.16015515618975, 74.03142454338604, 78.71857289577437, 82.06276498069886, 84.38759586673962, 86.29469286163241]
[alphaaa1(cov_toep(0.99,q)) for q in q_list]
[35.74129922798838, 55.63558896635379, 67.1216545130768, 74.1974025217765, 78.83310482926932, 82.04261087020382, 84.37246235469037, 86.13181245597147]
[alphaaa1(cov_toep(0.999999,q)) for q in q_list]
[48.99833404081616, 98.99333432995374, 148.9850017840501, 198.97333665305553, 248.95833918690025, 298.9400096354942, 348.91834824872825, 398.89335527647233]
[alphaaa2(i) for i in vp_i_d06]
[np.std(i)**2 for i in vp_i_d06]
[1.0998542783909298, 1.1041153802339447, 1.1011677773544855, 1.101184319828868, 1.098411455272186, 1.100177102223051, 1.1000248846885816, 1.1129641693672463]
def generator2(n, q, dep=True, s=0.6):
"""
Creating a function that gets into paramaters :
𝑛 the number of observations
𝑞 the dimension
𝑠 dependency threshold
𝜎² covariance parameter
and returns a matrix of n observations (n rows), where each row represents
a q-vector normally distributed with a mean 0 and covariance matrix S² defined
by a toeplitz matrix with a threshold s
"""
# defining eigenvalues, lognormal variables
if dep :
valeur_propre = cov_toep(s,q)
elif dep and s!=0.6 :
valeur_propre = cov_toep(s,q)
elif not dep :
valeur_propre = np.diag(vp_i_d06[q_list.index(q)])
elif not dep and s!=0.6 :
valeur_propre = np.diag(vp_i_d099[q_list.index(q)])
# defining a mean vector and a covariance matrix
mean = np.zeros(q) ; cov = valeur_propre
# z_intermediate = q rows and n columns we still need to transpose
z_int = np.random.multivariate_normal(mean, cov, n).T
# z sample matrix, having n rows and q columns
z = np.transpose(z_int)
# Returning the matrix of n-observations of dimension q
return z
def sn2(z):
return np.cov(np.transpose(z))
valeur_prp = np.linalg.eigvals(sn2(generator(100,100)))
list(data_i_d06.keys()).index((100,100))
15
rhooo = np.mean(np.array(data_i_d06[list(data_i_d06.keys())[15]][:,5]))
rhooo
1.6283411691367207
sum([i/(i+rhooo) for i in valeur_prp])
30.32047389867073
data_i_d06[list(data_i_d06.keys()).index((50,50))]
--------------------------------------------------------------------------- KeyError Traceback (most recent call last) /tmp/ipykernel_121864/2278547022.py in <module> ----> 1 data_i_d06[list(data_i_d06.keys()).index((50,50))] KeyError: 0
np.mean(np.array(data_i_d06[list(data_i_d06.keys()).index((50,50))][:,5]))
--------------------------------------------------------------------------- KeyError Traceback (most recent call last) /tmp/ipykernel_121864/364457376.py in <module> ----> 1 np.mean(np.array(data_i_d06[list(data_i_d06.keys()).index((50,50))][:,5])) KeyError: 0
def new_n(n, q) :
valeur_prp = np.linalg.eigvals(sn2(generator(n,q)))
rhooo = np.mean(np.array(data_i_d06[(n,q)][:,5]))
new_n = sum([np.real(i)/(np.real(i)+rhooo) for i in valeur_prp])
return new_n
new_n(50,50)
13.553143284392274
fig, axs = plt.subplots(2, 1, constrained_layout=True)
axs = axs.ravel()
def bounding(n, t):
return (2*np.exp(3)/9)*((t-n)/2)**(n/2)*np.exp(-(t-13.53)/2)/gamma((n/2)+1)
n = 13.532586672317716
grid = list(range(2*(int(n)+1),5*int(n)))
axs[0].plot(grid, list(map(lambda x : bounding(n,x), grid)), color="red", alpha=0.5, ls="-", label="c="+str(n))
n = 50
elem = self_collection[50]
for i in range(0,len(elem),1):
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[0].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=1)
#plt.set_title('q = '+str(q))
def bounding(n, t):
return (2*np.exp(3)/9)*((t-n)/2)**(n/2)*np.exp(-(t-13.53)/2)/gamma((n/2)+1)
n = 30.32047389867073
grid = list(range(2*(int(n)+1),5*int(n)))
def bounding(n, t):
return (2*np.exp(3)/9)*((t-n)/2)**(n/2)*np.exp(-(t-n)/2)/gamma((n/2)+1)
axs[1].plot(grid, list(map(lambda x : bounding(n,x), grid)), color="red", alpha=0.5, ls="-", label="c="+str(n))
n = 100
elem = self_collection[100]
for i in range(0,len(elem),1):
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[1].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*(i/k))
#plt.set_title('q = '+str(q))
plt.show()
sns_i06 = {}
for q in q_list:
sns_i06[q]=[(k[0],s[:,1]/2) for k,s in data_i_d06.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_i06[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
%matplotlib notebook
fig, axs = plt.subplots(6, 1, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list[2:]) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*(i/k))
axs[j].set_title('q = '+str(q))
n = int(new_n(n,q))+1
grid = list(range(2*n,5*n))
def bounding(n, t):
return (2*np.exp(3)/9)*((t-n)/2)**(n/2)*np.exp(-(t-n)/2)/gamma((n/2)+1)
axs[j].plot(grid, list(map(lambda x : bounding(n,x), grid)), color="red", ls="--", label="c="+str(n), alpha=0.3 + 0.7*(i/k))
if j%2==0: axs[j].legend(loc="upper right")
fig.suptitle("independent case - small eigenvalue dispersion")
At left, x abcisses are varying from 3.5538219909920765 to 69.4101672997359
Text(0.5, 0.98, 'independent case - small eigenvalue dispersion')
def new_n(n, q) :
valeur_prp = np.linalg.eigvals(sn2(generator2(n,q)))
rhooo = np.mean(np.array(data_d06[(n,q)][:,5]))
new_n = sum([np.real(i)/(np.real(i)+rhooo) for i in valeur_prp])
return new_n
new_n(50,50)
sns_d06 = {}
for q in q_list:
sns_d06[q]=[(k[0],s[:,1]/2) for k,s in data_d06.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_d06[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
%matplotlib notebook
fig, axs = plt.subplots(6, 1, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list[2:]) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*(i/k))
axs[j].set_title('q = '+str(q))
n = int(new_n(n,q))+1
grid = list(range(2*n,5*n))
def bounding(n, t):
return (2*np.exp(3)/9)*((t-n)/2)**(n/2)*np.exp(-(t-n)/2)/gamma((n/2)+1)
axs[j].plot(grid, list(map(lambda x : bounding(n,x), grid)), color="red", ls="--", label="c="+str(n), alpha=0.3 + 0.7*(i/k))
if j%2==0: axs[j].legend(loc="upper right")
fig.suptitle("independent case - small eigenvalue dispersion")
At left, x abcisses are varying from 4.943290704135637 to 95.64736475937819
Text(0.5, 0.98, 'independent case - small eigenvalue dispersion')
def new_n(n, q) :
valeur_prp = np.linalg.eigvals(sn2(generator2(n,q, True, 0.99)))
rhooo = np.mean(np.array(data_d099[(n,q)][:,5]))
new_n = sum([np.real(i)/(np.real(i)+rhooo) for i in valeur_prp])
return new_n
new_n(50,50)
sns_d099 = {}
for q in q_list:
sns_d099[q]=[(k[0],s[:,1]/2) for k,s in data_d099.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_d099[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
%matplotlib notebook
fig, axs = plt.subplots(6, 1, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list[2:]) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*(i/k))
axs[j].set_title('q = '+str(q))
n = int(new_n(n,q))+1
grid = list(range(2*n,5*n))
def bounding(n, t):
return (2*np.exp(3)/9)*((t-n)/2)**(n/2)*np.exp(-(t-n)/2)/gamma((n/2)+1)
axs[j].plot(grid, list(map(lambda x : bounding(n,x), grid)), color="red", ls="--", alpha=0.3 + 0.7*(i/k))
if j%2==1: axs[j].legend(loc="upper right")
fig.suptitle("independent case - small eigenvalue dispersion")
At left, x abcisses are varying from 2.8784473234331536 to 199.06116442264096
Text(0.5, 0.98, 'independent case - small eigenvalue dispersion')
def bounding(n, t):
return (2*np.exp(3)/9)*((t-n)/2)**(n/2)*np.exp(-(t-n)/2)/gamma((n/2)+1)
bnd_dict = {}
for n in n_list:
bnd_dict[n] = lambda x : bounding(n, x)
np.array(data_i_d06[list(data_i_d06.keys())[0]][:,5])
array([2.03998054, 2.03917162, 2.07417604, 2.67788863, 2.79957817, 2.03394657, 1.50870118, 2.21109279, 2.12232567, 2.8942398 , 2.15524431, 2.49264376, 1.92506973, 3.04232852, 1.7971891 , 1.71247326, 2.11286554, 2.66778201, 2.26438553, 2.79294965, 2.21366609, 2.07136301, 3.15417372, 2.09250452, 2.30745706, 2.73000053, 2.67192149, 2.54828971, 2.84417185, 1.63947489, 2.61814544, 1.96865111, 3.02084617, 2.45781727, 1.87405677, 1.59553851, 2.91621693, 1.76063165, 2.42241887, 3.14857344, 1.62841161, 3.30617685, 1.93757816, 2.00902075, 2.38434173, 2.57299415, 2.35313034, 2.35799981, 2.28423216, 1.95007763, 2.58169006, 3.10859097, 3.03585123, 2.78990215, 2.44760281, 2.05540316, 2.73712548, 2.7549841 , 2.41521086, 2.28855001, 2.25103873, 1.81159918, 2.15419616, 2.38137181, 2.64961056, 2.128354 , 2.08582175, 2.22652662, 3.23791677, 3.76905873, 3.0302594 , 1.90163534, 1.73135787, 3.79893779, 2.02504069, 2.78795306, 2.20016358, 2.69090842, 1.42239092, 2.84223249, 2.68609166, 1.67594242, 1.95181233, 2.35101374, 2.83553073, 1.96513041, 2.72332786, 1.81388538, 2.65616864, 2.73408424, 2.27829403, 3.03845435, 2.87986699, 2.47771341, 2.5349401 , 1.87313879, 3.00446889, 2.61438194, 2.83289303, 2.52395209, 1.92281108, 2.17069878, 1.94037588, 2.64651448, 2.62354301, 2.12266317, 2.38794248, 2.01791179, 2.25814547, 1.74472016, 3.45583564, 2.10221778, 2.23619699, 2.59988434, 2.63871087, 1.56250535, 1.56850676, 2.70821689, 2.4120203 , 1.92186184, 1.39116778, 2.27490861, 2.24188577, 1.650095 , 2.35043037, 2.72591786, 1.91879385, 1.92817172, 2.27512961, 2.12402207, 2.52642375, 2.45680325, 2.90220417, 2.06843401, 1.87048052, 2.8521437 , 2.08173685, 1.56384868, 2.51159668, 2.12095086, 1.77957354, 2.18145344, 2.3217068 , 2.29015234, 2.37223848, 2.25012781, 3.18334695, 2.46873796, 2.35763671, 2.43598056, 2.58434292, 1.81728122, 2.83844755, 2.67957694, 2.73046134, 2.13404649, 1.94623848, 2.55289906, 2.21546594, 1.68861548, 3.07287063, 2.36250378, 2.65721295, 1.80501533, 2.63489192, 2.08540384, 2.56626581, 1.76190748, 3.14371002, 2.8689718 , 1.72186552, 2.79357457, 2.6089001 , 2.44318285, 2.00905525, 2.39947421, 2.62109288, 3.60708053, 2.17956924, 2.43734483, 2.7183174 , 2.2094534 , 1.71639854, 2.72773522, 2.66643068, 2.03333716, 2.42720571, 1.46917071, 2.55789687, 1.56031666, 1.88802883, 1.65165362, 2.56071134, 2.29106304, 2.68391725, 2.53352761, 2.4111725 , 2.46987178, 2.37868233, 2.33147905, 1.68418055, 2.24153354, 2.64145786, 2.50925475, 2.68049468, 2.62709109, 2.57087604, 2.2997085 , 2.28596068, 2.85584241, 2.2230514 , 2.42874886, 2.12406597, 2.41120885, 1.75282264, 1.54908378, 2.38512418, 2.26340254, 3.69603063, 2.14667345, 2.39132333, 1.8295286 , 1.89023715, 1.83969494, 2.81105672, 2.17800868, 2.73491665, 1.72388937, 3.58652959, 3.83017132, 2.19437549, 1.87061141, 3.00554736, 2.31925876, 2.10772774, 2.9097434 , 3.56262955, 2.52115613, 1.72118971, 1.42396066, 2.55232475, 2.55428004, 2.02683344, 2.41244664, 2.1704444 , 2.7484077 , 1.99064688, 2.95487875, 2.40033338, 2.79349547, 2.50413875, 3.60538554, 2.31959032, 2.16504138, 2.29568466, 2.69705629, 2.37057176, 1.95880638, 2.0853072 , 1.95441208, 3.29577596, 2.38779638, 2.01194276, 2.20550568, 1.96921084, 1.91410248, 2.16517932, 4.03781425, 1.383246 , 1.75379823, 2.70181343, 2.22397322, 2.36056732, 2.61843177, 1.84283821, 2.09738843, 2.13694027, 1.90282267, 1.96206874, 2.46719469, 2.5971015 , 1.65804961, 2.28656733, 1.92709632, 2.05480482, 1.48334816, 1.97431894, 2.32528959, 1.87900744, 2.36137309, 2.43762311, 2.62088639, 2.18349653, 1.82224081, 3.00113785, 1.45800979, 2.06016174, 2.37529336, 2.0481299 , 1.98795229, 2.36227115, 2.26839821, 1.8473063 , 2.39617033, 2.39085817, 2.90580572, 3.06040845, 2.49322782, 1.92908005, 2.10004668, 2.53501363, 1.89701103, 2.23911738, 1.53222422, 2.45315357, 2.21348527, 1.83396439, 1.82187197, 1.91916901, 1.77163866, 2.25296492, 2.5476398 , 1.88019516, 2.35373619, 3.63303646, 2.45354631, 1.62413176, 1.45240207, 2.66790627, 2.89629568, 2.55672569, 2.2527546 , 2.06741745, 2.56250219, 1.65421105, 2.06211636, 2.51461679, 2.08408962, 2.46007275, 1.96130659, 1.94532829, 1.82930065, 1.98289624, 1.67979665, 3.04841709, 2.2200862 , 2.68664647, 2.32715853, 1.84954257, 1.78225132, 1.63398005, 1.29935881, 2.60274009, 1.64678742, 3.13786834, 2.32030262, 1.71449214, 2.17900526, 2.13513274, 2.0389091 , 2.37454204, 3.03675001, 1.96456886, 2.32807479, 1.68715729, 2.92746221, 1.91334068, 2.10215991, 3.32882407, 1.86625378, 2.0072357 , 2.55055366, 2.18168098, 2.41343674, 2.01234596, 1.80834243, 1.85345794, 2.07348585, 1.47850815, 2.19664665, 1.96615772, 1.53703287, 2.65212362, 2.85113664, 2.03949568, 2.9616764 , 2.36481861, 1.82594777, 2.5117203 , 1.92646139, 1.97988684, 3.01557924, 1.50076391, 1.58781331, 2.09256051, 2.32992027, 2.50738193, 2.66772408, 2.11821067, 2.6716843 , 2.28952172, 1.91454354, 2.18509909, 2.51405339, 1.25800304, 1.99454569, 2.47453292, 2.7033948 , 1.5455683 , 2.67006319, 2.36320245, 2.10642387, 2.68690603, 2.60280526, 2.54939323, 1.46650144, 2.02290318, 1.54901538, 2.55364588, 2.53317005, 1.72837295, 2.03956684, 3.06520008, 2.86193498, 2.44358745, 2.14296899, 2.31898733, 1.9867376 , 2.06861528, 1.69988564, 2.33580243, 2.31677941, 1.85586687, 2.45419521, 2.9310694 , 1.76176912, 2.1034548 , 1.60535513, 1.84691945, 3.05238807, 1.66190313, 1.91214359, 1.87453451, 2.07105373, 2.43733845, 2.57100791, 3.76471554, 2.37609887, 1.62721162, 2.19880456, 2.44810379, 1.97999646, 2.46671937, 1.65675673, 2.47897785, 2.93562842, 3.67027535, 1.7547965 , 2.21361779, 2.25083578, 2.56215308, 2.16892728, 1.89261079, 2.95734219, 1.76320468, 2.35448452, 2.20291944, 2.18047236, 2.14398792, 2.59327866, 2.69660118, 2.33199442, 2.24267329, 2.23422907, 1.69710637, 2.19932861, 2.46220795, 2.40847731, 2.28628665, 2.59615949, 2.32975589, 2.04619485, 1.60184523, 1.58308588, 1.76942092, 2.16617802, 2.20178637, 2.85203481, 2.25384363, 2.32120057, 1.65236758, 1.82632438, 1.90931687, 2.27871761, 1.90887166, 2.06881248, 2.54705012, 2.6984121 , 1.71260274, 2.73542552, 2.20252515, 2.62717629, 1.92334042, 2.02794608, 1.94027178, 2.5056634 , 2.18491101, 2.89188538, 2.68855175, 2.00793004, 1.75550422, 2.84268692, 2.00464893, 2.33287614, 2.40415155, 2.24318568, 2.8521995 , 2.71385625, 2.66943424, 2.9034095 , 2.65977354, 1.82939886, 3.33413492, 2.36026995, 3.88761454, 2.11381263, 2.23632576, 2.48770556, 1.7521417 , 2.58283926, 2.31328952, 1.87565208, 2.21693252, 2.37339636, 1.7426599 , 2.4767002 , 2.31889851, 2.48841295, 1.75844944, 2.77117246, 2.21773754, 2.36175259, 2.34713651, 2.06262767, 2.85146374, 2.45535221, 2.38045625, 1.59307983, 2.51061128, 2.01644266, 1.5065055 , 2.28204873, 2.49579565, 2.2826149 , 2.42026125, 1.91368352, 1.9797368 , 2.06089375, 2.57333485, 2.0669293 , 1.9915872 , 2.62503682, 2.51636166, 2.40096013, 2.26636509, 1.83223775, 3.30936349, 1.94430044, 1.92323355, 2.95398584, 2.18547206, 1.53174551, 2.04240716, 1.58932346, 2.63803109, 2.51490651, 2.25598854, 2.07865629, 2.36005493, 2.77056362, 2.57199163, 2.74533776, 2.2101258 , 2.25850968, 2.15203308, 2.01732848, 2.51973912, 2.07700617, 2.22464179, 2.12935527, 2.70466014, 2.32359986, 2.03340753, 2.75686573, 3.11618175, 2.36792282, 1.33124797, 3.22201243, 2.51861263, 2.4004449 , 2.65260827, 1.74005394, 2.26136206, 1.94768154, 2.20958208, 1.99941242, 2.62162864, 2.04976079, 2.39346906, 2.18818512, 2.54526059, 3.95229365, 1.87611869, 2.60607365, 2.74402902, 2.69699625, 2.09871087, 3.05193513, 2.61952285, 2.34224339, 1.60773204, 2.3118869 , 3.76738466, 2.89229921, 2.13610321, 2.03260063, 2.28479944, 2.04745377, 2.12878261, 2.43301984, 1.99491296, 2.4206763 , 2.06417082, 2.81888251, 2.29603198, 1.94794202, 2.42954507, 2.39172803, 1.98573397, 2.57775262, 2.21622913, 1.92717903, 3.1974736 , 3.24464829, 1.93172586, 2.0701054 , 3.3272983 , 2.74033288, 2.44268228, 1.86868339, 2.30505794, 2.51718932, 2.85607559, 2.70701221, 2.05564468, 2.28858068, 3.04167667, 2.13478036, 3.34881056, 1.78093361, 2.66925373, 1.95936946, 3.03470898, 2.54715911, 1.77994954, 2.24034143, 2.22114889, 1.92438385, 2.45146059, 1.99516406, 2.80555747, 2.36494332, 2.28326569, 1.97305367, 3.02182628, 2.8381005 , 2.66795746, 1.59399269, 2.30936183, 1.89429393, 2.04342479, 2.00371546, 3.04418964, 1.96096501, 2.04745445, 2.21879554, 2.159684 , 2.38060993, 2.61784817, 1.971074 , 1.87099302, 3.33055621, 2.82673847, 2.21693995, 2.1854566 , 2.29945525, 1.68704746, 1.83414281, 1.75653855, 1.94905033, 1.89346257, 2.52610883, 2.0461199 , 2.0726639 , 2.07370286, 2.52233201, 2.29303942, 2.22070786, 2.98871682, 2.11546403, 2.14343391, 1.57243148, 2.11823703, 1.61554942, 1.55757304, 2.45982856, 1.61257523, 1.60616591, 2.06648374, 2.19441626, 2.7182699 , 2.24447646, 2.72570308, 2.10660274, 2.21656085, 2.92854524, 2.09817663, 2.83232494, 2.31276993, 3.38613773, 1.82565615, 2.2130839 , 2.75474323, 2.39668521, 1.95347994, 2.6809489 , 2.98975304, 1.71316914, 1.5412026 , 2.73119833, 1.8848086 , 1.7754376 , 2.59731923, 2.24981677, 2.85098472, 1.34253143, 2.39328248, 2.71657709, 1.571662 , 2.1158589 , 1.77223985, 1.65897172, 2.52342398, 2.37815431, 2.14446277, 1.76533586, 2.20939997, 2.87738193, 2.55773859, 1.63525513, 2.14041432, 1.75450885, 2.75725907, 2.73434497, 1.93104184, 1.8770163 , 2.10913078, 2.30652299, 2.36047157, 1.69199747, 2.61063064, 2.04238568, 2.59074986, 2.65024865, 2.91120217, 2.95361861, 1.65186711, 2.20584205, 2.57833123, 1.63169777, 2.10765057, 2.6129512 , 2.55071445, 2.18669242, 2.08988229, 2.43462906, 2.4493063 , 2.51467111, 2.3839101 , 1.79126135, 2.21943744, 2.28663347, 2.17018185, 2.13304714, 2.27700007, 3.14821216, 2.27302574, 2.9496476 , 3.52380632, 2.32598422, 1.57808086, 2.64759068, 2.21404827, 2.4698602 , 1.71493257, 2.75757763, 1.73541565, 1.93504405, 1.96205896, 2.33113529, 2.74812627, 2.79386374, 2.33498495, 2.07101007, 1.6913683 , 2.08300396, 3.56426898, 2.23391431, 2.04735892, 2.11813548, 2.45231208, 1.64030365, 2.82298745, 2.30578946, 2.0012585 , 1.8179108 , 1.52617705, 2.63406619, 2.2983199 , 2.2560941 , 1.90785702, 2.38545545, 2.29111648, 2.76151408, 2.51408134, 2.05183396, 3.84126832, 1.71705331, 3.00007723, 1.56537898, 1.48707613, 2.62988348, 2.95142719, 1.89833061, 2.43910473, 2.03753508, 1.57505811, 2.48710164, 2.53334527, 3.17723348, 2.46752981, 4.63869174, 1.69801536, 1.61642835, 2.59743581, 1.71602129, 2.20246812, 2.25811723, 2.49403932, 2.42713574, 2.25161209, 2.43529548, 3.20513805, 1.43838483, 1.57171296, 1.74087427, 1.96237125, 2.5082547 , 1.76961882, 2.05910938, 2.08138398, 2.19614173, 2.51481649, 2.40019923, 1.92899025, 2.39695687, 2.17601447, 1.99261936, 2.86941925, 2.97211686, 2.46317822, 1.85926508, 2.11705914, 1.79122563, 1.8811859 , 2.20764598, 3.14001396, 1.77339845, 1.94772465, 1.72942508, 1.84582721, 3.04020657, 2.10442751, 2.21288876, 2.78836395, 2.65171743, 2.6759321 , 2.43305564, 2.09322619, 1.23664211, 3.04098584, 2.15159937, 2.39298953, 2.33913471, 2.19807209, 3.00705516, 2.38950634, 3.2963282 , 2.29312871, 1.98456852, 1.58884112, 2.36408231, 2.05485532, 2.10330743, 2.42797973, 1.73855933, 1.86423176, 2.3772023 , 3.03588276, 2.3735078 , 3.42432044, 2.50669761, 2.15414828, 2.50139363, 1.8531946 , 1.96971986, 2.64028326, 2.32621032, 2.01887824, 2.62787889, 2.23426146, 2.24756046, 2.07890257, 2.75598214, 2.45372228, 1.96416716, 1.95985107, 2.30780125, 1.87006426, 2.51390949, 2.36040556, 2.42889107, 1.52096458, 2.27208194, 1.85719884, 1.64859558, 2.46314455, 1.73016698, 1.74895616, 2.15054046, 2.93817404, 1.75110143, 2.46763466, 3.25478348, 1.85209904, 2.98938659, 2.2761244 , 1.6335096 , 1.30884824, 1.3092442 , 1.84300922, 2.65885211, 2.09462308, 2.18016981, 1.87085862, 2.06495827, 1.50753489, 2.04503887, 1.51238783, 2.56996084, 1.94432655, 2.64018399, 1.53183793, 1.71489376, 2.44309963, 1.5973186 , 1.70781989, 1.74406849, 2.47697342, 2.48101605, 2.7012521 , 2.29153554, 2.24626592, 1.93531552, 2.18342452, 2.51389699, 1.96831959, 1.70149412, 2.57567579, 3.19416242, 2.61635126, 1.91886668, 1.85714847, 1.87592614, 1.59488353, 2.28097206, 2.36301516, 2.37165894, 2.4527169 ])
plt.hist(data_i_d06[list(data_i_d06.keys())[0]][:,5], bins=45, label="q=50")
plt.axvline(np.mean(data_i_d06[list(data_i_d06.keys())[0]][:,5]), color="darkblue", alpha=1, label="mean")
plt.hist(data_i_d06[list(data_i_d06.keys())[3]][:,5], bins=45, label="q=200")
plt.axvline(np.mean(data_i_d06[list(data_i_d06.keys())[3]][:,5]), alpha=1, color="orangered")
plt.hist(data_i_d06[list(data_i_d06.keys())[7]][:,5], bins=45, label="q=400")
plt.axvline(np.mean(data_i_d06[list(data_i_d06.keys())[7]][:,5]), color="olive", alpha=1)
plt.legend(loc="upper right")
# plt.title("rho* - independent case, n=50")
plt.xticks(list(plt.xticks()[0])[:1]+[round(np.mean(data_i_d06[list(data_i_d06.keys())[0]][:,5]),3)]+list(plt.xticks()[0])[2:])
plt.show()
list(data_i_d06.keys()).index((100,400))
21
plt.hist(data_i_d06[list(data_i_d06.keys())[17]][:,5], bins=45, label="q=200")
plt.axvline(np.mean(data_i_d06[list(data_i_d06.keys())[0]][:,5]), color="darkblue", alpha=1, label="mean")
plt.hist(data_i_d06[list(data_i_d06.keys())[19]][:,5], bins=45, label="q=300")
plt.axvline(np.mean(data_i_d06[list(data_i_d06.keys())[3]][:,5]), alpha=1, color="orangered")
plt.hist(data_i_d06[list(data_i_d06.keys())[21]][:,5], bins=45, label="q=400")
plt.axvline(np.mean(data_i_d06[list(data_i_d06.keys())[7]][:,5]), color="olive", alpha=1)
plt.legend(loc="upper right")
# plt.title("rho* - independent case, n=50")
plt.xticks(list(plt.xticks()[0])[:1]+[round(np.mean(data_i_d06[list(data_i_d06.keys())[0]][:,5]),3)]+list(plt.xticks()[0])[2:])
plt.show()
[2*np.std(i)**2*q_list[j]/50 for j,i in enumerate(vp_i_d06)]
[2.1997085567818595, 4.416461520935779, 6.607006664126913, 8.809474558630944, 10.98411455272186, 13.202125226676612, 15.400348385640143, 17.80742670987594]
list(data_i_d06.keys()).index((100,100))
15
plt.hist(data_i_d06[list(data_i_d06.keys())[0]][:,5], bins=45, label="q=50")
plt.hist(data_i_d06[list(data_i_d06.keys())[15]][:,5], bins=45, label="q=100")
plt.hist(data_i_d06[list(data_i_d06.keys())[39]][:,5], bins=45, label="q=200")
plt.axvline(np.mean(data_i_d06[list(data_i_d06.keys())[0]][:,5]), color="darkblue", alpha=1, label="mean")
plt.axvline(np.mean(data_i_d06[list(data_i_d06.keys())[15]][:,5]), color="orangered", alpha=1)
plt.axvline(np.mean(data_i_d06[list(data_i_d06.keys())[39]][:,5]), color="olive", alpha=1)
plt.legend(loc="upper right")
# plt.title("rho = independent case, s=0.6, n=q")
plt.show()
plt.hist(data_i_d06[list(data_i_d06.keys())[1]][:,5], bins=45, label="q=100")
plt.hist(data_i_d06[list(data_i_d06.keys())[17]][:,5], bins=45, label="q=200")
plt.hist(data_i_d06[list(data_i_d06.keys())[43]][:,5], bins=45, label="q=400")
plt.axvline(np.mean(data_i_d06[list(data_i_d06.keys())[1]][:,5]), color="darkblue", alpha=1, label="mean")
plt.axvline(np.mean(data_i_d06[list(data_i_d06.keys())[17]][:,5]), color="orangered", alpha=1)
plt.axvline(np.mean(data_i_d06[list(data_i_d06.keys())[43]][:,5]), color="olive", alpha=1)
plt.legend(loc="upper right")
# plt.title("rho = independent case, s=0.6, n=2q")
plt.show()
plt.hist(data_d06[list(data_d06.keys())[0]][:,5], bins=45, label="q=50")
plt.hist(data_d06[list(data_d06.keys())[3]][:,5], bins=45, label="q=200")
plt.hist(data_d06[list(data_d06.keys())[7]][:,5], bins=45, label="q=400")
plt.axvline(np.mean(data_d06[list(data_d06.keys())[0]][:,5]), color="darkblue", alpha=1, label="mean")
plt.axvline(np.mean(data_d06[list(data_d06.keys())[3]][:,5]), color="orangered", alpha=1)
plt.axvline(np.mean(data_d06[list(data_d06.keys())[7]][:,5]), color="olive", alpha=1)
plt.legend(loc="upper right")
# plt.title("rho* - dependent case, s=0.6, n=50")
plt.show()
plt.hist(data_d06[list(data_d06.keys())[0]][:,5], bins=45, label="q=50")
plt.hist(data_d06[list(data_d06.keys())[39]][:,5], bins=45, label="q=200")
plt.axvline(np.mean(data_d06[list(data_d06.keys())[0]][:,5]), color="darkblue", alpha=1, label="mean")
plt.axvline(np.mean(data_d06[list(data_d06.keys())[39]][:,5]), color="orangered", alpha=1)
plt.legend(loc="upper right")
# plt.title("rho = dependent case, s=0.6, n=q")
plt.show()
plt.hist(data_d06[list(data_d06.keys())[1]][:,5], bins=45, label="q=100")
plt.hist(data_d06[list(data_d06.keys())[17]][:,5], bins=45, label="q=200")
plt.hist(data_d06[list(data_d06.keys())[31]][:,5], bins=45, label="q=300")
plt.hist(data_d06[list(data_d06.keys())[43]][:,5], bins=45, label="q=400")
plt.axvline(np.mean(data_d06[list(data_d06.keys())[1]][:,5]), color="darkblue", alpha=1, label="mean")
plt.axvline(np.mean(data_d06[list(data_d06.keys())[17]][:,5]), color="orangered", alpha=1)
plt.axvline(np.mean(data_d06[list(data_d06.keys())[31]][:,5]), color="olive", alpha=1)
plt.axvline(np.mean(data_d06[list(data_d06.keys())[43]][:,5]), color="maroon", alpha=1)
plt.legend(loc="upper right")
#plt.title("rho = dependent case, s=0.6, n=2q")
plt.show()
%matplotlib notebook
fig, axs = plt.subplots(3, 2, constrained_layout=True)
axs = axs.ravel()
axs[0].hist(data_i_d06[list(data_i_d06.keys())[0]][:,1], bins=45, label="q=50", color="orange")
axs[0].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[0]][:,1]), color="orangered", alpha=1, label="mean")
axs[0].hist(data_i_d06[list(data_i_d06.keys())[3]][:,1], bins=45, label="q=200", color="blue")
axs[0].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[3]][:,1]), alpha=1, color="darkblue")
axs[0].hist(data_i_d06[list(data_i_d06.keys())[7]][:,1], bins=45, label="q=400", color="green")
axs[0].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[7]][:,1]), color="olive", alpha=1)
#axs[0].legend(loc="upper right")
axs[2].hist(data_i_d06[list(data_i_d06.keys())[0]][:,1], bins=45, label="q=50", color="orange")
axs[2].hist(data_i_d06[list(data_i_d06.keys())[15]][:,1], bins=45, label="q=100", color='red')
axs[2].hist(data_i_d06[list(data_i_d06.keys())[39]][:,1], bins=45, label="q=200", color="blue")
axs[2].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[0]][:,1]), color="orangered", alpha=1, label="mean")
axs[2].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[15]][:,1]), color="hotpink", alpha=1)
axs[2].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[39]][:,1]), color="darkblue", alpha=1)
#axs[2].legend(loc="upper right")
axs[4].hist(data_i_d06[list(data_i_d06.keys())[1]][:,1], bins=45, label="q=100", color='red')
axs[4].hist(data_i_d06[list(data_i_d06.keys())[17]][:,1], bins=45, label="q=200", color="blue")
axs[4].hist(data_i_d06[list(data_i_d06.keys())[31]][:,1], bins=45, label="q=300", color="gold")
axs[4].hist(data_i_d06[list(data_i_d06.keys())[43]][:,1], bins=45, label="q=400", color="green")
axs[4].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[1]][:,1]), color="darkblue", alpha=1, label="mean")
axs[4].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[17]][:,1]), color="darkblue", alpha=1)
axs[4].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[31]][:,1]), color="coral", alpha=1)
axs[4].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[43]][:,1]), color="olive", alpha=1)
#axs[4].legend(loc="upper right")
axs[1].hist(data_d06[list(data_d06.keys())[0]][:,1], bins=45, label="q=50", color="orange")
axs[1].hist(data_d06[list(data_d06.keys())[3]][:,1], bins=45, label="q=200", color="blue")
axs[1].hist(data_d06[list(data_d06.keys())[7]][:,1], bins=45, label="q=400", color="green")
axs[1].axvline(np.mean(data_d06[list(data_d06.keys())[0]][:,1]), color="orangered", alpha=1, label="mean")
axs[1].axvline(np.mean(data_d06[list(data_d06.keys())[3]][:,1]), color="darkblue", alpha=1)
axs[1].axvline(np.mean(data_d06[list(data_d06.keys())[7]][:,1]), color="olive", alpha=1)
#axs[1].legend(loc="upper right")
axs[3].hist(data_d06[list(data_d06.keys())[0]][:,1], bins=45, label="q=50", color="orange")
axs[3].hist(data_d06[list(data_d06.keys())[15]][:,1], bins=45, label="q=100", color='red')
axs[3].hist(data_d06[list(data_d06.keys())[39]][:,1], bins=45, label="q=200", color="blue")
axs[3].axvline(np.mean(data_d06[list(data_d06.keys())[0]][:,1]), color="orangered", alpha=1, label="mean")
axs[3].axvline(np.mean(data_d06[list(data_d06.keys())[15]][:,1]), color="darkblue", alpha=1)
axs[3].axvline(np.mean(data_d06[list(data_d06.keys())[39]][:,1]), color="darkblue", alpha=1)
axs[3].legend(loc="upper right")
axs[5].hist(data_d06[list(data_d06.keys())[1]][:,1], bins=45, label="q=100", color='red')
axs[5].hist(data_d06[list(data_d06.keys())[17]][:,1], bins=45, label="q=200", color="blue")
axs[5].hist(data_d06[list(data_d06.keys())[31]][:,1], bins=45, label="q=300", color="gold")
axs[5].hist(data_d06[list(data_d06.keys())[43]][:,1], bins=45, label="q=400", color="green")
axs[5].axvline(np.mean(data_d06[list(data_d06.keys())[1]][:,1]), color="hotpink", alpha=1, label="mean")
axs[5].axvline(np.mean(data_d06[list(data_d06.keys())[17]][:,1]), color="darkblue", alpha=1)
axs[5].axvline(np.mean(data_d06[list(data_d06.keys())[31]][:,1]), color="coral", alpha=1)
axs[5].axvline(np.mean(data_d06[list(data_d06.keys())[43]][:,1]), color="olive", alpha=1)
axs[5].legend(loc="upper right")
#plt.title("rho = dependent case, s=0.6, n=2q")
#handles, labels = axs.get_legend_handles_labels()
#fig.legend(handles, labels, loc='upper center')
plt.show()
3.4375
plt.hist(data_i_d099[list(data_i_d099.keys())[0]][:,5], bins=45, label="q=50")
plt.hist(data_i_d099[list(data_i_d099.keys())[3]][:,5], bins=45, label="q=200")
plt.hist(data_i_d099[list(data_i_d099.keys())[7]][:,5], bins=45, label="q=400")
plt.legend(loc="upper right")
plt.title("rho* - independent case, s=0.99, n=50")
plt.show()
[2*np.std(i)**2*q_list[j]/50 for j,i in enumerate(vp_i_d099)]
[71.62645278541201, 222.0230443723224, 402.96093093713847, 592.2513963470883, 787.1857289577437, 984.7531797683863, 1181.4263421343546, 1380.7150857861186]
plt.hist(data_i_d099[list(data_i_d099.keys())[0]][:,5], bins=45, label="q=50")
plt.hist(data_i_d099[list(data_i_d099.keys())[39]][:,5], bins=45, label="q=200")
plt.legend(loc="upper right")
plt.title("rho = independent case, s=0.6, n=q")
plt.show()
plt.hist(data_i_d099[list(data_i_d099.keys())[1]][:,5], bins=45, label="q=100")
plt.hist(data_i_d099[list(data_i_d099.keys())[17]][:,5], bins=45, label="q=200")
plt.hist(data_i_d099[list(data_i_d099.keys())[43]][:,5], bins=45, label="q=400")
plt.legend(loc="upper right")
plt.title("rho = independent case, s=0.6, n=2q")
plt.show()
plt.hist(data_d099[list(data_d099.keys())[0]][:,5], bins=45, label="q=50")
plt.hist(data_d099[list(data_d099.keys())[39]][:,5], bins=45, label="q=200")
plt.legend(loc="upper right")
plt.title("rho = dependent case, s=0.99, n=q")
plt.show()
plt.hist(data_d099[list(data_d099.keys())[0]][:,5], bins=45, label="q=50")
plt.hist(data_d099[list(data_d099.keys())[39]][:,5], bins=45, label="q=200")
plt.legend(loc="upper right")
plt.title("rho = dependent case, s=0.99, n=q")
plt.show()
plt.hist(data_d099[list(data_d099.keys())[1]][:,5], bins=45, label="q=100")
plt.hist(data_d099[list(data_d099.keys())[17]][:,5], bins=45, label="q=200")
plt.hist(data_d099[list(data_d099.keys())[31]][:,5], bins=45, label="q=300")
plt.hist(data_d099[list(data_d099.keys())[43]][:,5], bins=45, label="q=400")
plt.legend(loc="upper right")
plt.title("rho = dependent case, s=0.6, n=2q")
plt.show()
list(data_id.keys()).index((150,150))
28
plt.hist(data_id[list(data_id.keys())[0]][:,5][~np.isfinite(data_id[list(data_id.keys())[0]][:,5])==False] , bins=45, label="q=50", range=(0,400))
plt.hist(data_id[list(data_id.keys())[28]][:,5][~np.isfinite(data_id[list(data_id.keys())[28]][:,5])==False] , bins=45, label="q=150", range=(0,400))
plt.hist(data_id[list(data_id.keys())[39]][:,5][~np.isfinite(data_id[list(data_id.keys())[39]][:,5])==False], bins=45, label="q=200", range=(0,400))
plt.legend(loc="upper right")
plt.title("rho = iid case, n=2q")
plt.show()
%matplotlib inline
plt.hist(data_id[list(data_id.keys())[1]][:,5][~np.isfinite(data_id[list(data_id.keys())[1]][:,5])==False] , bins=45, label="q=100", range=(0,400))
plt.hist(data_id[list(data_id.keys())[17]][:,5][~np.isfinite(data_id[list(data_id.keys())[17]][:,5])==False], bins=45, label="q=200", range=(0,400), histtype="step", linewidth=2, ls="--")
plt.hist(data_id[list(data_id.keys())[31]][:,5][~np.isfinite(data_id[list(data_id.keys())[31]][:,5])==False], bins=45, label="q=300", range=(0,400), histtype="step", linewidth=2, ls="-")
plt.hist(data_id[list(data_id.keys())[43]][:,5][~np.isfinite(data_id[list(data_id.keys())[43]][:,5])==False], bins=45, label="q=400", range=(0,400), histtype="step", linewidth=2, ls="--")
plt.legend(loc="upper right")
plt.title("rho = iid case, n=2q")
plt.show()
sns_i06 = {}
for q in q_list:
sns_i06[q]=[(k[0],s[:,1]/2) for k,s in data_i_d06.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_i06[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
sns_d06 = {}
for q in q_list:
sns_d06[q]=[(k[0],s[:,1]/2) for k,s in data_d06.items() if k[1]==q]
self_collection2 = {}
self_collection2 = dict([(q,[i[1] for i in sns_d06[q]]) for q in q_list])
min_v2 = min([min(j) for i in self_collection2.values() for j in i])
max_v2 = max([max(j) for i in self_collection2.values() for j in i])
print("At right x abcisses are varying from ", min_v2, " to ", max_v2)
%matplotlib notebook
fig, axs = plt.subplots(4, 2, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list[4:]) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*(i/k))
axs[2*j].set_title('q = '+str(q))
axs[2*j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.3 + 0.7*(i/k))
if j%2==0: axs[2*j].legend(loc="upper right")
for j, q in enumerate(q_list[4:]) :
elem = self_collection2[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j+1].plot(np.arange(min_v2,max_v2,1),
list(map(cum_tail, np.arange(min_v2,max_v2,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*(i/k))
axs[2*j+1].set_title('q = '+str(q))
axs[2*j+1].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.3 + 0.7*(i/k))
if j%2==0: axs[2*j+1].legend(loc="upper right")
fig.suptitle("Self normalized sums \n Left side : independent case Right side : dependent case (s=0.6)", size=11)
At left, x abcisses are varying from 3.5538219909920765 to 69.4101672997359 At right x abcisses are varying from 4.943290704135637 to 95.64736475937819
Text(0.5, 0.98, 'Self normalized sums \n Left side : independent case Right side : dependent case (s=0.6)')
sns_i06 = {}
for q in q_list:
sns_i06[q]=[(k[0],s[:,1]/2) for k,s in data_i_d06.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_i06[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
sns_d06 = {}
for q in q_list:
sns_d06[q]=[(k[0],s[:,1]/2) for k,s in data_d06.items() if k[1]==q]
self_collection2 = {}
self_collection2 = dict([(q,[i[1] for i in sns_d06[q]]) for q in q_list])
min_v2 = min([min(j) for i in self_collection2.values() for j in i])
max_v2 = max([max(j) for i in self_collection2.values() for j in i])
print("At right x abcisses are varying from ", min_v2, " to ", max_v2)
%matplotlib notebook
fig, axs = plt.subplots(4, 2, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list[4:]) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*(i/k))
axs[2*j].set_title('q = '+str(q))
axs[2*j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.3 + 0.7*(i/k))
if j%2==0: axs[2*j].legend(loc="upper right")
for j, q in enumerate(q_list[4:]) :
elem = self_collection2[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j+1].plot(np.arange(min_v2,max_v2,1),
list(map(cum_tail, np.arange(min_v2,max_v2,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*(i/k))
axs[2*j+1].set_title('q = '+str(q))
axs[2*j+1].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.3 + 0.7*(i/k))
if j%2==0: axs[2*j+1].legend(loc="upper right")
fig.suptitle("Self normalized sums (s=0.6) \n Left side : independent case Right side : dependend case")
plt.show()
At left, x abcisses are varying from 3.5538219909920765 to 69.4101672997359 At right x abcisses are varying from 4.943290704135637 to 95.64736475937819
sns_i099 = {}
for q in q_list:
sns_i099[q]=[(k[0],s[:,1]/3) for k,s in data_i_d099.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_i099[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
sns_d099 = {}
for q in q_list:
sns_d099[q]=[(k[0],s[:,1]/3) for k,s in data_d099.items() if k[1]==q]
self_collection2 = {}
self_collection2 = dict([(q,[i[1] for i in sns_d099[q]]) for q in q_list])
min_v2 = min([min(j) for i in self_collection2.values() for j in i])
max_v2 = max([max(j) for i in self_collection2.values() for j in i])
print("At right x abcisses are varying from ", min_v2, " to ", max_v2)
%matplotlib notebook
fig, axs = plt.subplots(4, 2, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list[4:]) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*(i/k))
axs[2*j].set_title('q = '+str(q))
axs[2*j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.3 + 0.7*(i/k))
if j%2==0: axs[2*j].legend(loc="upper right")
for j, q in enumerate(q_list[4:]) :
elem = self_collection2[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j+1].plot(np.arange(min_v2,max_v2,1),
list(map(cum_tail, np.arange(min_v2,max_v2,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*(i/k))
axs[2*j+1].set_title('q = '+str(q))
axs[2*j+1].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.3 + 0.7*(i/k))
if j%2==0: axs[2*j+1].legend(loc="upper right")
fig.suptitle("Left side : independent case Right side : dependend case (s=0.99)", size=11)
plt.show()
At left, x abcisses are varying from 6.854616603507005 to 182.33652848105416 At right x abcisses are varying from 1.918964882288769 to 132.7074429484273
sns_id = {}
for q in q_list:
sns_id[q]=[(k[0],s[:,5][~np.isfinite(s[:,5])==False] ) for k,s in data_id.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_id[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
%matplotlib notebook
fig, axs = plt.subplots(4, 2, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
k = len(elem)
axs[j].hist(elem[i], label="n="+str(n), color="black", alpha=0.3 + 0.7*(i/k), bins=50, density=True, range=(0, 400))
axs[j].set_title('q = '+str(q))
axs[j].hist(np.random.chisquare(n,999), range=(0,400), color="red", alpha=0.3 + 0.7*(i/k), density=True, bins=50)
if j%2==0: axs[j].legend(loc="upper right")
fig.suptitle("rho* - Identity covariance matrix")
data_i_d06[list(data_i_d06.keys())[0]][:,5]
sns_i_d0999999 = {}
for q in q_list:
sns_i_d0999999[q]=[(k[0],s[:,1]/(2+(k3_d0999999[q_list.index(q)]/s[:,5]))) for k,s in data_i_d0999999.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_i_d0999999[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print(min_v,max_v)
%matplotlib notebook
fig, axs = plt.subplots(4, 1, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list[:4]) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n_list[i]),
color="black", alpha=0.2 + 0.8*(i/k))
axs[j].set_title('q = '+str(q))
axs[j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
axs[j].legend(loc="upper right")
fig.suptitle("self normalized sums ; independent case with alpha = q-1")
0.13316120741307022 4.4000829892661875
Text(0.5, 0.98, 'self normalized sums ; independent case with alpha = q-1')
sns_i_d0999999 = {}
for q in q_list:
sns_i_d0999999[q]=[(k[0],s[:,1]/(2+(k3_d0999999[q_list.index(q)]/s[:,5]))) for k,s in data_i_d0999999.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_i_d0999999[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print(min_v,max_v)
%matplotlib notebook
fig, axs = plt.subplots(4, 1, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list[:4]) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n_list[i]),
color="black", alpha=0.2 + 0.8*(i/k))
axs[j].set_title('q = '+str(q))
# axs[j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
axs[j].legend(loc="upper right")
fig.suptitle("self normalized sums ; independent case with alpha = q-1")
0.13316120741307022 4.4000829892661875
Text(0.5, 0.98, 'self normalized sums ; independent case with alpha = q-1')
k3_d_0999999 = [max(1/min(np.linalg.eigvals(cov_toep(0.999999,q))),max(np.linalg.eigvals(cov_toep(0.999999,q)))) for q in q_list]
print(*k3_d_0999999)
1998025.729458815 1999505.5595714475 1999779.6834937092 1999875.632787539 1999920.042472222 1999944.169817904 1999958.7162985844 1999968.1582511098
k3_d_06 = [max(1/min(np.linalg.eigvals(cov_toep(0.6,q))),max(np.linalg.eigvals(cov_toep(0.6,q)))) for q in q_list]
print(*k3_d_06)
3.996336838160397 3.9990794093675825 3.9995901488211545 3.9997692631051005 3.999852253522595 3.999897363692014 3.9999245756079675 3.9999422428030087
for q in q_list:
sigma = scalar(cov_toep(0.999999,q), np.diag(np.ones(q)))
alpha = alphaaa1(cov_toep(0.999999,q))
print((np.mean([np.mean(s[:,-1]) for k,s in data_d0999999.items() if k[1]==q])/alpha)*sigma)
0.038453713565117356 0.02907845671214838 0.024169312807812565 0.020506587178772545 0.019671279381357903 0.01928105858205496 0.02044248941925989 0.020247447831096894
for q in q_list:
sigma = scalar(cov_toep(0.99,q), np.diag(np.ones(q)))
alpha = alphaaa1(cov_toep(0.99,q))
print((np.mean([np.mean(s[:,-1]) for k,s in data_d06.items() if k[1]==q])/alpha)*sigma)
0.029914996809180295 0.026921236285454356 0.02664140660906044 0.02709389711361688 0.03179803425861559 0.03659678269220877 0.04148794435737056 0.04641128263325102
for q in q_list:
sigma = scalar(cov_toep(0.6,q), np.diag(np.ones(q)))
alpha = alphaaa1(cov_toep(0.6,q))
print((np.mean([np.mean(s[:,-1]) for k,s in data_d06.items() if k[1]==q])/alpha)*sigma)
0.9810588466110213 1.3524916477233462 1.60625654133289 1.8010007987604317 2.2422252572570933 2.68285819891338 3.125455167937518 3.5672571686334305
for q in q_list:
sigma = scalar(np.diag(vp_i_d06[q_list.index(q)]), np.diag(np.ones(q)))
alpha = alphaaa1(np.diag(vp_i_d06[q_list.index(q)]))
print((np.mean([np.mean(s[:,-1]) for k,s in data_i_d06.items() if k[1]==q])/alpha)*sigma)
1.7432466881982678 2.1186050077059386 3.0332841995516135 2.9647148993187624 2.8955420053399226 4.255444248770757 4.098080242492344 4.263431499438611
for q in q_list:
sigma = scalar(np.diag(vp_i_d0999999[q_list.index(q)]), np.diag(np.ones(q)))
alpha = alphaaa1(np.diag(vp_i_d0999999[q_list.index(q)]))
print((np.mean([np.mean(s[:,-1]) for k,s in data_i_d0999999.items() if k[1]==q])/alpha)*sigma)
0.763668796759087 0.4518175638091019 0.6627179173507056 0.8396649842206156 0.7191328661599021 1.0916179009439255 1.1592377512394583 1.6614925021130669
# fig, axs = plt.subplots(4, 1, constrained_layout=True)
# axs = axs.ravel()
true_rho = {}
for i, q in enumerate(q_list):
sigma = scalar(cov_toep(0.999999,q), np.diag(np.ones(q)))
alpha = alphaaa1(cov_toep(0.999999,q))
true_rho["dep0999"].append((np.mean([np.mean(s[:,-1]) for k,s in data_d0999999.items() if k[1]==q])/alpha)*sigma)
true_rho
--------------------------------------------------------------------------- KeyError Traceback (most recent call last) /tmp/ipykernel_28746/103916051.py in <module> 7 sigma = scalar(cov_toep(0.999999,q), np.diag(np.ones(q))) 8 alpha = alphaaa1(cov_toep(0.999999,q)) ----> 9 true_rho["dep0999"].append((np.mean([np.mean(s[:,-1]) for k,s in data_d0999999.items() if k[1]==q])/alpha)*sigma) 10 11 true_rho KeyError: 'dep0999'
sns_i_d0999999 = {}
for q in q_list:
sns_i_d0999999[q]=[(k[0],s[:,1]) for k,s in data_i_d0999999.items() if k[1]==q]
rho_i_d0999999 = {}
for q in q_list:
rho_i_d0999999[q]=[(k[0],s[:,5]) for k,s in data_i_d0999999.items() if k[1]==q]
print(sns_i_d0999999[50][0][1][:10])
print(rho_i_d0999999[50][0][1][:10])
print(rho_i_d0999999[100][1][1][:10])
print()
[43.88733674 35.88542368 46.92557092 35.38860792 48.28979666 26.0180303 39.58455166 33.21734738 49.70511527 44.70188689] [0.97517228 0.82186637 1.01884367 0.79663506 0.71673144 0.91771605 0.7783041 0.61852578 0.81043709 0.80008075] [0.40597056 0.43360759 0.38844019 0.4904587 0.40451553 0.48624083 0.52656068 0.38074326 0.53671932 0.45829431]
k3_i_0999999 = [max(1/min(i),max(i)) for i in vp_i_d0999999]
print(*k3_i_0999999)
45.29940815474966 96.87992949000329 134.01271228817757 229.74375940301246 218.14189476429118 263.6794858907057 308.2566589572174 2195.078706817729
normalized_sns_i_d0999999 = {}
for q in q_list:
normalized_sns_i_d0999999[q]=[(i[1]/(2+k3_i_0999999[q_list.index(q)]/j[1])) for i in sns_i_d0999999[q] for j in rho_i_d0999999[q] if i[0]==j[0]]
print(normalized_sns_i_d0999999[50][0][:10])
print(normalized_sns_i_d0999999[100][1][:10])
[0.90577647 0.62827119 1.00998636 0.60119846 0.74060965 0.50657144 0.65752109 0.44149869 0.85853851 0.7625895 ] [0.48965035 0.50426596 0.65993861 0.51353199 0.56713744 0.62583457 0.54934117 0.40322703 0.72638404 0.62747615]
sns_d0999999 = {}
for q in q_list:
sns_d0999999[q]=[(k[0],s[:,1]) for k,s in data_d0999999.items() if k[1]==q]
rho_d0999999 = {}
for q in q_list:
rho_d0999999[q]=[(k[0],s[:,5]) for k,s in data_d0999999.items() if k[1]==q]
print("some self normalized sums values for dependent case, s = 0.999999, n=50 and q = 50 \n", sns_d0999999[50][0][1][:10])
print()
print("some rho* values for dependent case, s = 0.999999, n=50 and q = 50 \n", rho_d0999999[50][0][1][:10])
print()
print("some rho* values for dependent case, s = 0.999999, n=125 and q = 100 \n", rho_d0999999[100][1][1][:10])
print()
k3_d0999999 = [max(1/min(np.linalg.eigvals(cov_toep(0.999999,q))),max(np.linalg.eigvals(cov_toep(0.999999,q)))) for q in q_list]
print("K_3 values for dependent case, s = 0.999999, q in [50,400] \n", *k3_d0999999)
normalized_sns_d0999999 = {}
for q in q_list:
normalized_sns_d0999999[q]=[(i[1]/(2+k3_d0999999[q_list.index(q)]/j[1])) for i in sns_d0999999[q] for j in rho_d0999999[q] if i[0]==j[0]]
print()
print("some self normalized sums values when devided by a* for dependent case, s = 0.999999, n=50 and q = 50 \n", normalized_sns_d0999999[50][0][:10])
print()
print("some self normalized sums values when devided by a* for dependent case, s = 0.999999, n=100 and q = 125 \n", normalized_sns_d0999999[100][1][:10])
some self normalized sums values for dependent case, s = 0.999999, n=50 and q = 50 [1.64509626 0.29002798 0.10439978 0.73843782 0.49000752 0.40264237 0.07185128 0.0578168 2.17832531 0.24413013] some rho* values for dependent case, s = 0.999999, n=50 and q = 50 [0.01780515 0.06023146 0.06442765 0.02839663 0.04228446 0.05536354 0.02220691 0.02856431 0.03139944 0.0503666 ] some rho* values for dependent case, s = 0.999999, n=125 and q = 100 [0.02381535 0.03395323 0.03300447 0.02719997 0.02866538 0.02463004 0.02746778 0.03677543 0.02465772 0.01337403] K_3 values for dependent case, s = 0.999999, q in [50,400] 1998025.729458815 1999505.5595714475 1999779.6834937092 1999875.632787539 1999920.042472222 1999944.169817904 1999958.7162985844 1999968.1582511098 some self normalized sums values when devided by a* for dependent case, s = 0.999999, n=50 and q = 50 [1.46600659e-08 8.74303441e-09 3.36643935e-09 1.04949331e-08 1.03700885e-08 1.11568667e-08 7.98585847e-10 8.26564505e-10 3.42328861e-08 6.15407706e-09] some self normalized sums values when devided by a* for dependent case, s = 0.999999, n=100 and q = 125 [2.30502907e-09 6.50536125e-09 6.75256754e-09 2.84783579e-09 9.99973974e-09 3.78561724e-09 2.47063262e-08 8.63468254e-09 3.42175884e-09 6.21591525e-09]
sns_d099 = {}
for q in q_list:
sns_d099[q]=[(k[0],s[:,1]) for k,s in data_d099.items() if k[1]==q]
rho_d099 = {}
for q in q_list:
rho_d099[q]=[(k[0],s[:,5]) for k,s in data_d099.items() if k[1]==q]
print(sns_d099[50][0][1][:10])
print(rho_d099[50][0][1][:10])
print(rho_d099[100][1][1][:10])
k3_d099 = [max(1/min(np.linalg.eigvals(cov_toep(0.99,q))),max(np.linalg.eigvals(cov_toep(0.99,q)))) for q in q_list]
print(*k3_d099)
normalized_sns_d099 = {}
for q in q_list:
normalized_sns_d099[q]=[(i[1]/(2+k3_d099[q_list.index(q)]/j[1])) for i in sns_d099[q] for j in rho_d099[q] if i[0]==j[0]]
print(normalized_sns_d099[50][0][:10])
print(normalized_sns_d099[100][1][:10])
[31.01505244 15.07263119 22.63964527 13.89893018 13.08751105 20.50934046 16.89586704 16.65082279 24.96664927 30.51404468] [0.02948144 0.04663741 0.04675437 0.08096123 0.10420638 0.05668361 0.03365442 0.04236521 0.05192138 0.06264795] [0.0395921 0.04981256 0.03648612 0.03710322 0.04278628 0.04827389 0.02669292 0.03648589 0.04793914 0.03666504] 198.80370389506928 198.95090893008816 198.97818001880813 198.98772585868846 198.99214441245965 198.99454467239042 198.99599197531322 198.99693134025188 [0.00459799 0.00353423 0.00532186 0.00565562 0.00685286 0.00584436 0.00285924 0.00354679 0.00651711 0.00960967] [0.00925777 0.01145219 0.00702018 0.01012312 0.00980871 0.01165735 0.00574763 0.00719292 0.01692436 0.00594775]
sns_d06 = {}
for q in q_list:
sns_d06[q]=[(k[0],s[:,1]) for k,s in data_d06.items() if k[1]==q]
rho_d06 = {}
for q in q_list:
rho_d06[q]=[(k[0],s[:,5]) for k,s in data_d06.items() if k[1]==q]
print(sns_d06[50][0][1][:10])
print(rho_d06[50][0][1][:10])
print(rho_d06[100][1][1][:10])
k3_d06 = [max(1/min(np.linalg.eigvals(cov_toep(0.6,q))),max(np.linalg.eigvals(cov_toep(0.6,q)))) for q in q_list]
print(*k3_d06)
normalized_sns_d06 = {}
for q in q_list:
normalized_sns_d06[q]=[(i[1]/(2+k3_d06[q_list.index(q)]/j[1])) for i in sns_d06[q] for j in rho_d06[q] if i[0]==j[0]]
print(normalized_sns_d06[50][0][:10])
print(normalized_sns_d06[100][1][:10])
[22.9947615 24.37122884 19.73926661 24.9843607 31.08560516 33.77272227 22.70361678 30.4724475 16.45942667 28.33341166] [0.89177751 0.64923029 0.85137452 0.85866263 0.7219517 0.90697556 0.82374858 0.9416749 0.84967525 0.91411616] [1.22036355 1.20685844 1.22842528 1.04214334 1.13271142 1.1380357 1.27244876 1.239954 1.16159128 1.14962932] 3.996336838160397 3.9990794093675825 3.9995901488211545 3.9997692631051005 3.999852253522595 3.999897363692014 3.9999245756079675 3.9999422428030087 [3.54785377 2.98831829 2.94880775 3.75470873 4.12524161 5.27186155 3.31371762 4.88038577 2.45539592 4.44668587] [ 7.10378629 8.86356148 8.87411051 6.96444967 8.17752318 7.12118819 10.45928981 7.28044881 7.59714853 8.35607135]
np.linalg.eigvals(cov_toep(0.999999,q))[:10]
array([3.99946673e+02, 3.24177060e-02, 8.10553689e-03, 3.60263455e-03, 2.02657083e-03, 1.29707007e-03, 9.00795824e-04, 6.61854197e-04, 5.06771588e-04, 4.00447327e-04])
sns_d0999999 = {}
for q in q_list:
sns_d0999999[q]=[(k[0],s[:,1]/(2+(k3_d_0999999[q_list.index(q)]/s[:,5]))) for k,s in data_d0999999.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_d0999999[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print(min_v,max_v)
%matplotlib notebook
fig, axs = plt.subplots(4, 1, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list[:4]) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n_list[i]),
color="black", alpha=0.2 + 0.8*(i/k))
axs[j].set_title('q = '+str(q))
axs[j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
axs[j].legend(loc="upper right")
fig.suptitle("self normalized sums ; independent case with alpha = q-1")
9.327401002271784e-11 6.231701809997192e-07
Text(0.5, 0.98, 'self normalized sums ; independent case with alpha = q-1')
ls = [data_i_d06, data_i_d0999999, data_i2, data_d06, data_d099, data_d0999999]
names = dict(zip(["i06","i0999999", "d06", "d099", "d0999999"],
["independent case with sigma = 1 and alpha = 1.1",
"independent case with sigma = 1 and alpha = q-1",
"dependent case with s = 0.6",
"dependent case with s = 0.99",
"dependent case with s = 0.999999"]))
result = {}
for i, d in enumerate(ls) :
result[list(names.keys())[i]] = [s[:,1] for k,s in d.items() if k[0]==200 and k[1]==200][0]
sns_i_sigma1 = {}
for q in q_list:
sns_i_sigma1[q]=[(k[0],s[:,1]) for k,s in data_i1.items() if k[1]==q]
sns_i_sigma1.keys()
dict_keys([50, 100, 150, 200, 250, 300, 350, 400])
collection = [i[1] for i in sns_i_sigma1[200]]
len(collection)
collection2 = [i[1] for i in sns_i_sigma1[400]]
len(collection2)
7
elem = collection
elem2 = collection2
# min_v = min(min(collection), min(collection2))
for i in range(0,len(elem),1):
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
plt.plot(np.arange(min(elem[i]),max(elem[i]),1),
list(map(cum_tail, np.arange(min(elem[i]),max(elem[i]),1))), label="n="+str(n_list[i]),
color="black", alpha=0.2 + 0.8*(i/k))
plt.legend()
plt.show()
from math import gamma
n = 50
def bounding(t):
return (2*np.exp(3)/9)*((t-n)/2)**(n/2)*np.exp(-(t-n)/2)/gamma((n/2)+1)
grid = np.arange(2*n,3*n)
plt.plot(grid, list(map(bounding,grid)), alpha=1, linestyle="dashed", color="black")
plt.show()
def bounding(n, t):
return (2*np.exp(3)/9)*((t-n)/2)**(n/2)*np.exp(-(t-n)/2)/gamma((n/2)+1)
bnd_dict = {}
for n in n_list:
bnd_dict[n] = lambda x : bounding(n, x)
print(bnd_dict[n_list[0]](n_list[0]), bnd_dict[n_list[0]](n_list[1]))
print(bnd_dict[n_list[1]](n_list[1]), bnd_dict[n_list[0]](n_list[4]))
5.726374658622018e+62 2.5767609518622115e+49 2.5767609518622115e+49 2.1430395793193224e-07
elem = collection
elem2 = collection2
# min_v = min(min(collection), min(collection2))
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,max(max(elem[i]),3*n),1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
plt.plot(np.arange(min(elem[i]),max(elem[i]),1),
list(map(cum_tail, np.arange(min(elem[i]),max(elem[i]),1))), label="n="+str(n),
color="black", alpha=0.2 + 0.8*(i/k))
plt.plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
plt.title("q = 200")
plt.legend()
plt.show()
elem = collection
elem2 = collection2
# min_v = min(min(collection), min(collection2))
for i in range(0,len(elem2),1):
n = n_list[i]
grid = np.arange(2*n,max(max(elem2[i]),3*n),1)
k = len(elem2)
def cum(x):
F = np.array(sorted(elem2[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
plt.plot(np.arange(min(elem2[i]),max(elem2[i]),1),
list(map(cum_tail, np.arange(min(elem2[i]),max(elem2[i]),1))), label="n="+str(n),
color="black", alpha=0.2 + 0.8*(i/k))
plt.plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
plt.title("q = 400")
plt.legend()
plt.show()
collectionn = [i[1] for i in sns_i_sigma1[150]]
elem2 = collectionn
# min_v = min(min(collection), min(collection2))
for i in range(0,len(elem2),1):
n = n_list[i]
grid = np.arange(2*n,max(max(elem2[i]),3*n),1)
k = len(elem2)
def cum(x):
F = np.array(sorted(elem2[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
plt.plot(np.arange(min(elem2[i]),max(elem2[i]),1),
list(map(cum_tail, np.arange(min(elem2[i]),max(elem2[i]),1))), label="n="+str(n),
color="black", alpha=0.2 + 0.8*(i/k))
plt.plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
plt.title("q = 150")
plt.legend()
plt.show()
for i in range(0,len(elem2),1):
n = n_list[i]
grid = np.arange(2*n,max(max(elem2[i]),3*n),1)
k = len(elem2)
def cum(x):
F = np.array(sorted(elem2[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
plt.plot(np.arange(min(elem2[i]),max(elem2[i]),1),
list(map(cum_tail, np.arange(min(elem2[i]),max(elem2[i]),1))), label="n="+str(n),
color="black", alpha=0.2 + 0.8*(i/k))
plt.plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
plt.title("q = 400")
plt.legend()
plt.show()
elem2 = collection2
min_v = min([min(i) for i in collection]+[min(i) for i in collection2])
max_v = max([max(i) for i in collection]+[max(i) for i in collection2])
fig, axs = plt.subplots(2, 1, constrained_layout=True)
for i in range(0,len(elem),1):
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[0].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n_list[i]),
color="black", alpha=0.2 + 0.8*(i/k))
axs[0].set_title('q = 200')
axs[0].legend()
for i in range(0,len(elem2),1):
k = len(elem2)
def cum(x):
F = np.array(sorted(elem2[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[1].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n_list[i]),
color="black", alpha=0.2 + 0.8*(i/k))
axs[1].set_title('q = 400')
axs[1].set_xlabel('sns(p) values')
axs[1].set_ylabel('Tail distribution')
fig.suptitle('This is a somewhat long figure title', fontsize=16)
plt.show()
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_i_sigma1[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print(min_v,max_v)
9.579349116655408 264.5940454817879
%matplotlib notebook
fig, axs = plt.subplots(len(q_list), 1, constrained_layout=True)
for j, q in enumerate(q_list) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n_list[i]),
color="black", alpha=0.2 + 0.8*(i/k))
axs[j].set_title('q = '+str(q))
axs[j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
axs[j].legend(loc="upper right")
fig.suptitle("self normalized sums ; independent case with sigma = 1")
Text(0.5, 0.98, 'self normalized sums ; independent case with sigma = 1')
%matplotlib notebook
fig, axs = plt.subplots(2, 2, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list[4:]) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n_list[i]),
color="black", alpha=0.2 + 0.8*(i/k))
axs[j].set_title('q = '+str(q))
axs[j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
axs[j].legend(loc="upper right")
fig.suptitle("self normalized sums ; independent case with sigma = 1")
Text(0.5, 0.98, 'self normalized sums ; independent case with sigma = 1')
names.keys()
dict_keys(['i4', 'i1', 'i2', 'd025', 'd06', 'd099'])
sns_i_sigma04 = {}
for q in q_list:
sns_i_sigma04[q]=[(k[0],s[:,1]) for k,s in data_i4.items() if k[1]==q]
sns_i_sigma04.keys()
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_i_sigma04[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print(min_v,max_v)
%matplotlib notebook
fig, axs = plt.subplots(8, 1, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n_list[i]),
color="black", alpha=0.2 + 0.8*(i/k))
axs[j].set_title('q = '+str(q))
axs[j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
axs[j].legend(loc="upper right")
fig.suptitle("self normalized sums ; independent case with sigma = 0.4")
1.5995775657703097 45.91700505724189
Text(0.5, 0.98, 'self normalized sums ; independent case with sigma = 0.4')
sns_i_sigma2 = {}
for q in q_list:
sns_i_sigma2[q]=[(k[0],s[:,1]) for k,s in data_i2.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_i_sigma2[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print(min_v,max_v)
%matplotlib notebook
fig, axs = plt.subplots(8, 1, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n_list[i]),
color="black", alpha=0.2 + 0.8*(i/k))
axs[j].set_title('q = '+str(q))
axs[j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
axs[j].legend(loc="upper right")
fig.suptitle("self normalized sums ; independent case with sigma = 2")
10.974327356978865 515.3209086199577
Text(0.5, 0.98, 'self normalized sums ; independent case with sigma = 2')
sns_d_sigma025 = {}
for q in q_list:
sns_d_sigma025[q]=[(k[0],s[:,1]) for k,s in data_d025.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_d_sigma025[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print(min_v,max_v)
%matplotlib notebook
fig, axs = plt.subplots(8, 1, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n_list[i]),
color="black", alpha=0.2 + 0.8*(i/k))
axs[j].set_title('q = '+str(q))
axs[j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
axs[j].legend(loc="upper right")
fig.suptitle("self normalized sums ; dependent case with s = 0.25")
1.3919170730997021 38.96626368226072
Text(0.5, 0.98, 'self normalized sums ; dependent case with s = 0.25')
names.keys()
dict_keys(['i4', 'i1', 'i2', 'd025', 'd06', 'd099'])
sns_d_sigma099 = {}
for q in q_list:
sns_d_sigma099[q]=[(k[0],s[:,1]) for k,s in data_d099.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_d_sigma099[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print(min_v,max_v)
%matplotlib notebook
fig, axs = plt.subplots(8, 1, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n_list[i]),
color="black", alpha=0.2 + 0.8*(i/k))
axs[j].set_title('q = '+str(q))
axs[j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
axs[j].legend(loc="upper right")
fig.suptitle("self normalized sums ; dependent case with s = 0.99")
5.4163799687973455 397.3764201542196
Text(0.5, 0.98, 'self normalized sums ; dependent case with s = 0.99')
sns_i_sigma04 = {}
for n in n_list:
sns_i_sigma04[n]=[(k[1],s[:,1]) for k,s in data_i4.items() if k[0]==n]
sns_i_sigma04.keys()
self_collection = {}
self_collection = dict([(n,[i[1] for i in sns_i_sigma04[n]]) for n in n_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print(min_v,max_v)
%matplotlib notebook
fig, axs = plt.subplots(6, 1, constrained_layout=True)
axs = axs.ravel()
for j, n in enumerate(n_list[:6]) :
elem = self_collection[n]
for i in range(0,len(elem),1):
q = q_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="q="+str(q),
color="black", alpha=0.2 + 0.8*(i/k))
axs[j].set_title('n = '+str(n))
axs[j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
axs[j].legend(loc="upper right")
fig.suptitle("self normalized sums ; independent case with sigma = 0.4")
1.5995775657703097 45.91700505724189
Text(0.5, 0.98, 'self normalized sums ; independent case with sigma = 0.4')
names.keys()
dict_keys(['i4', 'i1', 'i2', 'd025', 'd06', 'd099'])
sns_i_sigma2 = {}
for n in n_list:
sns_i_sigma2[n]=[(k[1],s[:,1]) for k,s in data_i2.items() if k[0]==n]
self_collection = {}
self_collection = dict([(n,[i[1] for i in sns_i_sigma2[n]]) for n in n_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print(min_v,max_v)
%matplotlib notebook
fig, axs = plt.subplots(6, 1, constrained_layout=True)
axs = axs.ravel()
for j, n in enumerate(n_list[:6]) :
elem = self_collection[n]
for i in range(0,len(elem),1):
q = q_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="q="+str(q),
color="black", alpha=0.2 + 0.8*(i/k))
axs[j].set_title('n = '+str(n))
axs[j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
axs[j].legend(loc="upper right")
fig.suptitle("self normalized sums ; independent case with sigma = 2")
10.974327356978865 515.3209086199577
Text(0.5, 0.98, 'self normalized sums ; independent case with sigma = 2')
sns_d_sigma099 = {}
for n in n_list:
sns_d_sigma099[n]=[(k[1],s[:,1]) for k,s in data_d099.items() if k[0]==n]
self_collection = {}
self_collection = dict([(n,[i[1] for i in sns_d_sigma099[n]]) for n in n_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print(min_v,max_v)
%matplotlib notebook
fig, axs = plt.subplots(6, 1, constrained_layout=True)
axs = axs.ravel()
for j, n in enumerate(n_list[:6]) :
elem = self_collection[n]
for i in range(0,len(elem),1):
q = [q for q in q_list if q >= n][i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="q="+str(q),
color="black", alpha=0.2 + 0.8*(i/k))
axs[j].set_title('n = '+str(n))
axs[j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
if j == 0 or j == 5 : axs[j].legend(loc="upper right")
fig.suptitle("self normalized sums ; ependent case with s = 0.99")
5.4163799687973455 397.3764201542196
Text(0.5, 0.98, 'self normalized sums ; ependent case with s = 0.99')
%matplotlib notebook
color = ["r", "b", "g", "orange", "purple","black" ]
for j, n in enumerate(n_list[:6]) :
elem = self_collection[n]
for i in range(0,len(elem),1):
q = [q for q in q_list if q >= n][i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
if i%2 == 0 and (j == 0 or j == 5):
plt.plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="q="+str(q),
color=color[j], alpha=0.2 + 0.8*(i/k))
if j == 0 or j == 5 : plt.plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color=color[j], alpha=0.2 + 0.8*(i/k), label="n="+str(n))
plt.legend(loc = "upper right")
plt.title("self normalized sums ; dependent case with s = 0.99")
plt.show()
%matplotlib notebook
sns_i_sigma2 = {}
for n in n_list:
sns_i_sigma2[n]=[(k[1],s[:,1]) for k,s in data_i2.items() if k[0]==n]
self_collection = {}
self_collection = dict([(n,[i[1] for i in sns_i_sigma2[n]]) for n in n_list])
color = ["r", "b", "g", "orange", "purple","black" ]
for j, n in enumerate(n_list[:6]) :
elem = self_collection[n]
for i in range(0,len(elem),1):
q = [q for q in q_list if q >= n][i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
if i%2 == 0 and (j == 0 or j == 5):
plt.plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="q="+str(q),
color=color[j], alpha=0.2 + 0.8*(i/k))
if j == 0 or j == 5 : plt.plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color=color[j], alpha=0.2 + 0.8*(i/k), label="n="+str(n))
plt.legend(loc = "upper right")
plt.title("self normalized sums ; independent case with sigma = 2")
plt.show()
%matplotlib notebook
sns_i_sigma04 = {}
for n in n_list:
sns_i_sigma04[n]=[(k[1],s[:,1]) for k,s in data_i4.items() if k[0]==n]
self_collection = {}
self_collection = dict([(n,[i[1] for i in sns_i_sigma04[n]]) for n in n_list])
color = ["r", "b", "g", "orange", "purple","black" ]
for j, n in enumerate(n_list[:6]) :
elem = self_collection[n]
for i in range(0,len(elem),1):
q = [q for q in q_list if q >= n][i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
if i%2 == 0 and (j == 0 or j == 5):
plt.plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="q="+str(q),
color=color[j], alpha=0.2 + 0.8*(i/k))
if j == 0 or j == 5 : plt.plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color=color[j], alpha=0.2 + 0.8*(i/k), label="n="+str(n))
plt.legend(loc = "upper right")
plt.title("self normalized sums ; independent case with sigma = 0.4")
plt.show()
%matplotlib notebook
sns_d_sigma025 = {}
for n in n_list:
sns_d_sigma025[n]=[(k[1],s[:,1]) for k,s in data_d025.items() if k[0]==n]
self_collection = {}
self_collection = dict([(n,[i[1] for i in sns_d_sigma025[n]]) for n in n_list])
color = ["r", "b", "g", "orange", "purple","black" ]
for j, n in enumerate(n_list[:6]) :
elem = self_collection[n]
for i in range(0,len(elem),1):
q = [q for q in q_list if q >= n][i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
if i%2 == 0 and (j == 0 or j == 5):
plt.plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="q="+str(q),
color=color[j], alpha=0.2 + 0.8*(i/k))
if j == 0 or j == 5 : plt.plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color=color[j], alpha=0.2 + 0.8*(i/k), label="n="+str(n))
plt.legend(loc = "upper right")
plt.title("self normalized sums ; dependent case with s = 0.99")
plt.show()
data_d06.keys()
dict_keys([(50, 50), (50, 100), (50, 150), (50, 200), (50, 250), (50, 300), (50, 350), (50, 400), (75, 100), (75, 150), (75, 200), (75, 250), (75, 300), (75, 350), (75, 400), (100, 100), (100, 150), (100, 200), (100, 250), (100, 300), (100, 350), (100, 400), (125, 150), (125, 200), (125, 250), (125, 300), (125, 350), (125, 400), (150, 150), (150, 200), (150, 250), (150, 300), (150, 350), (150, 400), (175, 200), (175, 250), (175, 300), (175, 350), (175, 400), (200, 200), (200, 250), (200, 300), (200, 350), (200, 400)])
sns_d06 = {}
for q in q_list:
sns_d06[q]=[(k[0],s[:,1]) for k,s in data_d06.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_d06[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
sns_d0999999 = {}
for q in q_list:
sns_d0999999[q]=[(k[0],s[:,1]) for k,s in data_d0999999.items() if k[1]==q]
self_collection2 = {}
self_collection2 = dict([(q,[i[1] for i in sns_d0999999[q]]) for q in q_list])
min_v2 = min([min(j) for i in self_collection2.values() for j in i])
max_v2 = max([max(j) for i in self_collection2.values() for j in i])
print("At right x abcisses are varying from ", min_v2, " to ", max_v2)
%matplotlib notebook
fig, axs = plt.subplots(8, 2, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.2 + 0.8*(i/k))
axs[2*j].set_title('q = '+str(q))
axs[2*j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
#axs[2*j].legend(loc="upper right")
for j, q in enumerate(q_list) :
elem = self_collection2[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j+1].plot(np.arange(min_v2,max_v2,1),
list(map(cum_tail, np.arange(min_v2,max_v2,1))), label="n="+str(n),
color="black", alpha=0.2 + 0.8*(i/k))
axs[2*j+1].set_title('q = '+str(q))
axs[2*j+1].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
axs[2*j+1].legend(loc="upper right")
fig.suptitle("self normalized sums ; left side : dependent case (s = 0.6) ; right side : dependend case (s = 0.999999)")
At left, x abcisses are varying from 9.886581408271274 to 191.29472951875638 At right x abcisses are varying from 0.001877292455035084 to 20.99255372015822
Text(0.5, 0.98, 'self normalized sums ; left side : dependent case (s = 0.6) ; right side : dependend case (s = 0.999999)')
sns_i06 = {}
for q in q_list:
sns_i06[q]=[(k[0],s[:,1]) for k,s in data_i_d06.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_i06[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
sns_i0999999 = {}
for q in q_list:
sns_i0999999[q]=[(k[0],s[:,1]) for k,s in data_i_d0999999.items() if k[1]==q]
self_collection2 = {}
self_collection2 = dict([(q,[i[1] for i in sns_i0999999[q]]) for q in q_list])
min_v2 = min([min(j) for i in self_collection2.values() for j in i])
max_v2 = max([max(j) for i in self_collection2.values() for j in i])
print("At right x abcisses are varying from ", min_v2, " to ", max_v2)
%matplotlib notebook
fig, axs = plt.subplots(8, 2, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.2 + 0.8*(i/k))
axs[2*j].set_title('q = '+str(q))
axs[2*j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
#axs[2*j].legend(loc="upper right")
for j, q in enumerate(q_list) :
elem = self_collection2[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j+1].plot(np.arange(min_v2,max_v2,1),
list(map(cum_tail, np.arange(min_v2,max_v2,1))), label="n="+str(n),
color="black", alpha=0.2 + 0.8*(i/k))
axs[2*j+1].set_title('q = '+str(q))
axs[2*j+1].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
axs[2*j+1].legend(loc="upper right")
fig.suptitle("self normalized sums ; left side : independent case (s = 0.6) ; right side : independend case (s = 0.999999)")
At left, x abcisses are varying from 7.107643981984153 to 138.8203345994718 At right x abcisses are varying from 14.295827342059706 to 834.8600837886366
Text(0.5, 0.98, 'self normalized sums ; left side : independent case (s = 0.6) ; right side : independend case (s = 0.999999)')
for i in range(10):
print(9-i)
9 8 7 6 5 4 3 2 1 0
sns_i06 = {}
for q in q_list:
sns_i06[q]=[(k[0],s[:,1]) for k,s in data_i_d06.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_i06[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
sns_i0999999 = {}
for q in q_list:
sns_i0999999[q]=[(k[0],s[:,1]) for k,s in data_i_d0999999.items() if k[1]==q]
self_collection2 = {}
self_collection2 = dict([(q,[i[1] for i in sns_i0999999[q]]) for q in q_list])
min_v2 = min([min(j) for i in self_collection2.values() for j in i])
max_v2 = max([max(j) for i in self_collection2.values() for j in i])
print("At right x abcisses are varying from ", min_v2, " to ", max_v2)
%matplotlib notebook
fig, axs = plt.subplots(8, 2, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*((k-i)/k))
axs[2*j].set_title('q = '+str(q))
axs[2*j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", label="n="+str(n), color="red", alpha=0.3 + 0.7*((k-i)/k))
if j%2 == 0 : axs[2*j].legend(loc="upper right")
for j, q in enumerate(q_list) :
elem = self_collection2[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j+1].plot(np.arange(min_v2,max_v2,1),
list(map(cum_tail, np.arange(min_v2,max_v2,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*((k-i)/k))
axs[2*j+1].set_title('q = '+str(q))
axs[2*j+1].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", label="n="+str(n), color="red", alpha=0.3 + 0.7*((k-i)/k))
if j%2 == 0 : axs[2*j+1].legend(loc="upper right")
fig.suptitle("self normalized sums ; left side : independent case (s = 0.6) ; right side : independend case (s = 0.999999)")
At left, x abcisses are varying from 7.107643981984153 to 138.8203345994718 At right x abcisses are varying from 14.295827342059706 to 834.8600837886366
Text(0.5, 0.98, 'self normalized sums ; left side : independent case (s = 0.6) ; right side : independend case (s = 0.999999)')
sns_i06 = {}
for q in q_list:
sns_i06[q]=[(k[0],s[:,1]/2) for k,s in data_i_d06.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_i06[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
sns_d06 = {}
for q in q_list:
sns_d06[q]=[(k[0],s[:,1]/2) for k,s in data_d06.items() if k[1]==q]
self_collection2 = {}
self_collection2 = dict([(q,[i[1] for i in sns_d06[q]]) for q in q_list])
min_v2 = min([min(j) for i in self_collection2.values() for j in i])
max_v2 = max([max(j) for i in self_collection2.values() for j in i])
print("At right x abcisses are varying from ", min_v2, " to ", max_v2)
%matplotlib notebook
fig, axs = plt.subplots(8, 2, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*((k-i)/k))
axs[2*j].set_title('q = '+str(q))
axs[2*j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", label="n="+str(n), color="red", alpha=0.3 + 0.7*((k-i)/k))
if j%2 == 0 : axs[2*j].legend(loc="upper right")
for j, q in enumerate(q_list) :
elem = self_collection2[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j+1].plot(np.arange(min_v2,max_v2,1),
list(map(cum_tail, np.arange(min_v2,max_v2,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*((k-i)/k))
axs[2*j+1].set_title('q = '+str(q))
axs[2*j+1].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", label="n="+str(n), color="red", alpha=0.3 + 0.7*((k-i)/k))
if j%2 == 0 : axs[2*j+1].legend(loc="upper right")
fig.suptitle("self normalized sums ; left side : independent case (s = 0.6) ; right side : dependend case (s = 0.6)")
At left, x abcisses are varying from 3.5538219909920765 to 69.4101672997359 At right x abcisses are varying from 4.943290704135637 to 95.64736475937819
Text(0.5, 0.98, 'self normalized sums ; left side : independent case (s = 0.6) ; right side : dependend case (s = 0.6)')
sns_i0999999 = {}
for q in q_list:
sns_i0999999[q]=[(k[0],s[:,1]/2) for k,s in data_i_d0999999.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_i0999999[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
sns_d0999999 = {}
for q in q_list:
sns_d0999999[q]=[(k[0],s[:,1]/2) for k,s in data_d0999999.items() if k[1]==q]
self_collection2 = {}
self_collection2 = dict([(q,[i[1] for i in sns_d0999999[q]]) for q in q_list])
min_v2 = min([min(j) for i in self_collection2.values() for j in i])
max_v2 = max([max(j) for i in self_collection2.values() for j in i])
print("At right x abcisses are varying from ", min_v2, " to ", max_v2)
%matplotlib notebook
fig, axs = plt.subplots(8, 2, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*((k-i)/k))
axs[2*j].set_title('q = '+str(q))
axs[2*j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", label="n="+str(n), color="red", alpha=0.3 + 0.7*((k-i)/k))
if j%2 == 0 : axs[2*j].legend(loc="upper right")
for j, q in enumerate(q_list) :
elem = self_collection2[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j+1].plot(np.arange(min_v2,max_v2,1),
list(map(cum_tail, np.arange(min_v2,max_v2,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*((k-i)/k))
axs[2*j+1].set_title('q = '+str(q))
axs[2*j+1].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", label="n="+str(n), color="red", alpha=0.3 + 0.7*((k-i)/k))
if j%2 == 0 : axs[2*j+1].legend(loc="upper right")
fig.suptitle("self normalized sums ; left side : independent case (s = 0.999999) ; right side : dependend case (s = 0.999999)")
At left, x abcisses are varying from 7.147913671029853 to 417.4300418943183 At right x abcisses are varying from 0.000938646227517542 to 10.49627686007911
Text(0.5, 0.98, 'self normalized sums ; left side : independent case (s = 0.999999) ; right side : dependend case (s = 0.999999)')
%matplotlib inline
sns_d06 = {}
for q in q_list:
sns_d06[q]=[(k[0],s[:,1]) for k,s in data_d06.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_d06[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
sns_d0999999 = {}
for q in q_list:
sns_d0999999[q]=[(k[0],s[:,1]) for k,s in data_d0999999.items() if k[1]==q]
self_collection2 = {}
self_collection2 = dict([(q,[i[1] for i in sns_d0999999[q]]) for q in q_list])
min_v2 = min([min(j) for i in self_collection2.values() for j in i])
max_v2 = max([max(j) for i in self_collection2.values() for j in i])
print("At right x abcisses are varying from ", min_v2, " to ", max_v2)
fig, axs = plt.subplots(8, 2, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.2 + 0.8*(i/k))
axs[2*j].set_title('q = '+str(q))
axs[2*j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
#axs[2*j].legend(loc="upper right")
for j, q in enumerate(q_list) :
elem = self_collection2[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j+1].plot(np.arange(min_v2,max_v2,1),
list(map(cum_tail, np.arange(min_v2,max_v2,1))), label="n="+str(n),
color="black", alpha=0.2 + 0.8*(i/k))
axs[2*j+1].set_title('q = '+str(q))
axs[2*j+1].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
axs[2*j+1].legend(loc="upper right")
fig.suptitle("self normalized sums ; left side : dependent case (s = 0.6) ; right side : dependend case (s = 0.999999)")
sns_i06 = {}
for q in q_list:
sns_i06[q]=[(k[0],s[:,1]) for k,s in data_i_d06.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_i06[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
sns_i0999999 = {}
for q in q_list:
sns_i0999999[q]=[(k[0],s[:,1]) for k,s in data_i_d0999999.items() if k[1]==q]
self_collection2 = {}
self_collection2 = dict([(q,[i[1] for i in sns_i0999999[q]]) for q in q_list])
min_v2 = min([min(j) for i in self_collection2.values() for j in i])
max_v2 = max([max(j) for i in self_collection2.values() for j in i])
print("At right x abcisses are varying from ", min_v2, " to ", max_v2)
fig, axs = plt.subplots(8, 2, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.2 + 0.8*(i/k))
axs[2*j].set_title('q = '+str(q))
axs[2*j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
#axs[2*j].legend(loc="upper right")
for j, q in enumerate(q_list) :
elem = self_collection2[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j+1].plot(np.arange(min_v2,max_v2,1),
list(map(cum_tail, np.arange(min_v2,max_v2,1))), label="n="+str(n),
color="black", alpha=0.2 + 0.8*(i/k))
axs[2*j+1].set_title('q = '+str(q))
axs[2*j+1].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
axs[2*j+1].legend(loc="upper right")
fig.suptitle("self normalized sums ; left side : independent case (s = 0.6) ; right side : independend case (s = 0.999999)")
sns_i06 = {}
for q in q_list:
sns_i06[q]=[(k[0],s[:,1]) for k,s in data_i_d06.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_i06[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
sns_i0999999 = {}
for q in q_list:
sns_i0999999[q]=[(k[0],s[:,1]) for k,s in data_i_d0999999.items() if k[1]==q]
self_collection2 = {}
self_collection2 = dict([(q,[i[1] for i in sns_i0999999[q]]) for q in q_list])
min_v2 = min([min(j) for i in self_collection2.values() for j in i])
max_v2 = max([max(j) for i in self_collection2.values() for j in i])
print("At right x abcisses are varying from ", min_v2, " to ", max_v2)
fig, axs = plt.subplots(8, 2, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*((k-i)/k))
axs[2*j].set_title('q = '+str(q))
axs[2*j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", label="n="+str(n), color="red", alpha=0.3 + 0.7*((k-i)/k))
if j%2 == 0 : axs[2*j].legend(loc="upper right")
for j, q in enumerate(q_list) :
elem = self_collection2[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j+1].plot(np.arange(min_v2,max_v2,1),
list(map(cum_tail, np.arange(min_v2,max_v2,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*((k-i)/k))
axs[2*j+1].set_title('q = '+str(q))
axs[2*j+1].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", label="n="+str(n), color="red", alpha=0.3 + 0.7*((k-i)/k))
if j%2 == 0 : axs[2*j+1].legend(loc="upper right")
fig.suptitle("self normalized sums ; left side : independent case (s = 0.6) ; right side : independend case (s = 0.999999)")
sns_i06 = {}
for q in q_list:
sns_i06[q]=[(k[0],s[:,1]) for k,s in data_i_d06.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_i06[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
sns_i0999999 = {}
for q in q_list:
sns_i0999999[q]=[(k[0],s[:,1]) for k,s in data_i_d0999999.items() if k[1]==q]
self_collection2 = {}
self_collection2 = dict([(q,[i[1] for i in sns_i0999999[q]]) for q in q_list])
min_v2 = min([min(j) for i in self_collection2.values() for j in i])
max_v2 = max([max(j) for i in self_collection2.values() for j in i])
print("At right x abcisses are varying from ", min_v2, " to ", max_v2)
fig, axs = plt.subplots(8, 2, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*((k-i)/k))
axs[2*j].set_title('q = '+str(q))
axs[2*j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", label="n="+str(n), color="red", alpha=0.3 + 0.7*((k-i)/k))
if j%2 == 0 : axs[2*j].legend(loc="upper right")
for j, q in enumerate(q_list) :
elem = self_collection2[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j+1].plot(np.arange(min_v2,max_v2,1),
list(map(cum_tail, np.arange(min_v2,max_v2,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*((k-i)/k))
axs[2*j+1].set_title('q = '+str(q))
axs[2*j+1].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", label="n="+str(n), color="red", alpha=0.3 + 0.7*((k-i)/k))
if j%2 == 0 : axs[2*j+1].legend(loc="upper right")
fig.suptitle("self normalized sums ; left side : independent case (s = 0.6) ; right side : independend case (s = 0.999999)")
sns_i06 = {}
for q in q_list:
sns_i06[q]=[(k[0],s[:,1]) for k,s in data_i_d06.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_i06[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
sns_i0999999 = {}
for q in q_list:
sns_i0999999[q]=[(k[0],s[:,1]) for k,s in data_i_d0999999.items() if k[1]==q]
self_collection2 = {}
self_collection2 = dict([(q,[i[1] for i in sns_i0999999[q]]) for q in q_list])
min_v2 = min([min(j) for i in self_collection2.values() for j in i])
max_v2 = max([max(j) for i in self_collection2.values() for j in i])
print("At right x abcisses are varying from ", min_v2, " to ", max_v2)
fig, axs = plt.subplots(8, 2, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*((k-i)/k))
axs[2*j].set_title('q = '+str(q))
axs[2*j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", label="n="+str(n), color="red", alpha=0.3 + 0.7*((k-i)/k))
if j%2 == 0 : axs[2*j].legend(loc="upper right")
for j, q in enumerate(q_list) :
elem = self_collection2[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j+1].plot(np.arange(min_v2,max_v2,1),
list(map(cum_tail, np.arange(min_v2,max_v2,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*((k-i)/k))
axs[2*j+1].set_title('q = '+str(q))
axs[2*j+1].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", label="n="+str(n), color="red", alpha=0.3 + 0.7*((k-i)/k))
if j%2 == 0 : axs[2*j+1].legend(loc="upper right")
fig.suptitle("self normalized sums ; left side : independent case (s = 0.6) ; right side : independend case (s = 0.999999)")
At left, x abcisses are varying from 9.886581408271274 to 191.29472951875638 At right x abcisses are varying from 0.001877292455035084 to 20.99255372015822 At left, x abcisses are varying from 7.107643981984153 to 138.8203345994718 At right x abcisses are varying from 14.295827342059706 to 834.8600837886366 At left, x abcisses are varying from 7.107643981984153 to 138.8203345994718 At right x abcisses are varying from 14.295827342059706 to 834.8600837886366 At left, x abcisses are varying from 7.107643981984153 to 138.8203345994718 At right x abcisses are varying from 14.295827342059706 to 834.8600837886366 At left, x abcisses are varying from 7.107643981984153 to 138.8203345994718 At right x abcisses are varying from 14.295827342059706 to 834.8600837886366
Text(0.5, 0.98, 'self normalized sums ; left side : independent case (s = 0.6) ; right side : independend case (s = 0.999999)')
/home/mehdi/anaconda3/lib/python3.9/site-packages/IPython/core/events.py:89: UserWarning: constrained_layout not applied because axes sizes collapsed to zero. Try making figure larger or axes decorations smaller. func(*args, **kwargs) /home/mehdi/anaconda3/lib/python3.9/site-packages/IPython/core/pylabtools.py:151: UserWarning: constrained_layout not applied because axes sizes collapsed to zero. Try making figure larger or axes decorations smaller. fig.canvas.print_figure(bytes_io, **kw)
sns_d099 = {}
for q in q_list:
sns_d099[q]=[(k[0],s[:,1]/2) for k,s in data_d099.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_d099[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
%matplotlib notebook
fig, axs = plt.subplots(8, 1, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.2 + 0.8*(i/k))
axs[j].set_title('q = '+str(q))
axs[j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", color="red", alpha=0.2 + 0.8*(i/k))
if j%2==0: axs[j].legend(loc="upper right")
At left, x abcisses are varying from 2.8784473234331536 to 199.06116442264096
plt.hist(data_d099[list(data_d099.keys())[0]][:,5], bins=45, label="q=50")
plt.hist(data_d099[list(data_d099.keys())[-1]][:,5], bins=45, label="q=400")
plt.legend(loc="upper right")
plt.title("dependent case, s=0.99")
plt.show()
def new_n(n, q) :
valeur_prp = np.linalg.eigvals(sn2(generator2(n,q, True, 0.99)))
rhooo = np.mean(np.array(data_d099[(n,q)][:,5]))
new_n = sum([np.real(i)/(np.real(i)+rhooo) for i in valeur_prp])
return new_n
new_n(50,50)
sns_d099 = {}
for q in q_list:
sns_d099[q]=[(k[0],s[:,1]/2) for k,s in data_d099.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_d099[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
%matplotlib notebook
fig, axs = plt.subplots(6, 1, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list[2:]) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*(i/k))
axs[j].set_title('q = '+str(q))
n = int(new_n(n,q))+1
grid = list(range(2*n,5*n))
def bounding(n, t):
return (2*np.exp(3)/9)*((t-n)/2)**(n/2)*np.exp(-(t-n)/2)/gamma((n/2)+1)
axs[j].plot(grid, list(map(lambda x : bounding(n,x), grid)), color="red", ls="--", alpha=0.3 + 0.7*(i/k))
if j%2==1: axs[j].legend(loc="upper right")
fig.suptitle("independent case - small eigenvalue dispersion")
sns_i06 = {}
for q in q_list:
sns_i06[q]=[(k[0],s[:,1]/2) for k,s in data_i_d06.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_i06[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
sns_d06 = {}
for q in q_list:
sns_d06[q]=[(k[0],s[:,1]/2) for k,s in data_d06.items() if k[1]==q]
self_collection2 = {}
self_collection2 = dict([(q,[i[1] for i in sns_d06[q]]) for q in q_list])
min_v2 = min([min(j) for i in self_collection2.values() for j in i])
max_v2 = max([max(j) for i in self_collection2.values() for j in i])
print("At right x abcisses are varying from ", min_v2, " to ", max_v2)
%matplotlib notebook
fig, axs = plt.subplots(8, 2, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*((k-i)/k))
axs[2*j].set_title('q = '+str(q))
axs[2*j].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", label="n="+str(n), color="red", alpha=0.3 + 0.7*((k-i)/k))
if j%2 == 0 : axs[2*j].legend(loc="upper right")
for j, q in enumerate(q_list) :
elem = self_collection2[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j+1].plot(np.arange(min_v2,max_v2,1),
list(map(cum_tail, np.arange(min_v2,max_v2,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*((k-i)/k))
axs[2*j+1].set_title('q = '+str(q))
axs[2*j+1].plot(grid, list(map(bnd_dict[n],grid)), linestyle="dashed", label="n="+str(n), color="red", alpha=0.3 + 0.7*((k-i)/k))
if j%2 == 0 : axs[2*j+1].legend(loc="upper right")
fig.suptitle("self normalized sums ; left side : independent case (s = 0.6) ; right side : dependend case (s = 0.6)")
At left, x abcisses are varying from 3.5538219909920765 to 69.4101672997359 At right x abcisses are varying from 4.943290704135637 to 95.64736475937819
Text(0.5, 0.98, 'self normalized sums ; left side : independent case (s = 0.6) ; right side : dependend case (s = 0.6)')
def new_n(n, q) :
valeur_prp = np.linalg.eigvals(sn2(generator2(n,q, False)))
rhooo = np.mean(np.array(data_i_d06[(n,q)][:,5]))
new_n = sum([np.real(i)/(np.real(i)+rhooo) for i in valeur_prp])
return new_n
sns_i06 = {}
for q in q_list:
sns_i06[q]=[(k[0],s[:,1]/2) for k,s in data_i_d06.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_i06[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
sns_d06 = {}
for q in q_list:
sns_d06[q]=[(k[0],s[:,1]/2) for k,s in data_d06.items() if k[1]==q]
self_collection2 = {}
self_collection2 = dict([(q,[i[1] for i in sns_d06[q]]) for q in q_list])
min_v2 = min([min(j) for i in self_collection2.values() for j in i])
max_v2 = max([max(j) for i in self_collection2.values() for j in i])
print("At right x abcisses are varying from ", min_v2, " to ", max_v2)
%matplotlib notebook
fig, axs = plt.subplots(4, 2, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list[4:]) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*(i/k))
axs[2*j].set_title('q = '+str(q))
n = int(new_n(n,q))+1
grid = list(range(2*n,5*n))
def bounding(n, t):
return (2*np.exp(3)/9)*((t-n)/2)**(n/2)*np.exp(-(t-n)/2)/gamma((n/2)+1)
axs[2*j].plot(grid, list(map(lambda x : bounding(n,x), grid)), color="red", ls="--", alpha=0.3 + 0.7*(i/k))
if j%2==0: axs[2*j+1].legend(loc="upper right")
def new_n(n, q) :
valeur_prp = np.linalg.eigvals(sn2(generator2(n,q)))
rhooo = np.mean(np.array(data_d06[(n,q)][:,5]))
new_n = sum([np.real(i)/(np.real(i)+rhooo) for i in valeur_prp])
return new_n
for j, q in enumerate(q_list[4:]) :
elem = self_collection2[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j+1].plot(np.arange(min_v2,max_v2,1),
list(map(cum_tail, np.arange(min_v2,max_v2,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*(i/k))
axs[2*j+1].set_title('q = '+str(q))
n = int(new_n(n,q))+1
grid = list(range(2*n,5*n))
def bounding(n, t):
return (2*np.exp(3)/9)*((t-n)/2)**(n/2)*np.exp(-(t-n)/2)/gamma((n/2)+1)
axs[2*j+1].plot(grid, list(map(lambda x : bounding(n,x), grid)), color="red", ls="--", alpha=0.3 + 0.7*(i/k))
if j%2==0: axs[2*j+1].legend(loc="upper right")
fig.suptitle("Self normalized sums \n Left side : independent case Right side : dependent case (s=0.6)", size=11)
At left, x abcisses are varying from 3.5538219909920765 to 69.4101672997359 At right x abcisses are varying from 4.943290704135637 to 95.64736475937819
No handles with labels found to put in legend. No handles with labels found to put in legend.
Text(0.5, 0.98, 'Self normalized sums \n Left side : independent case Right side : dependent case (s=0.6)')
def new_n(n, q) :
valeur_prp = np.linalg.eigvals(sn2(generator2(n,q, False, 0.99)))
rhooo = np.mean(np.array(data_i_d099[(n,q)][:,5]))
new_n = sum([np.real(i)/(np.real(i)+rhooo) for i in valeur_prp])
return new_n
sns_i099 = {}
for q in q_list:
sns_i099[q]=[(k[0],s[:,1]/3) for k,s in data_i_d099.items() if k[1]==q]
self_collection = {}
self_collection = dict([(q,[i[1] for i in sns_i099[q]]) for q in q_list])
min_v = min([min(j) for i in self_collection.values() for j in i])
max_v = max([max(j) for i in self_collection.values() for j in i])
print("At left, x abcisses are varying from ", min_v, " to ", max_v)
sns_d099 = {}
for q in q_list:
sns_d099[q]=[(k[0],s[:,1]/3) for k,s in data_d099.items() if k[1]==q]
self_collection2 = {}
self_collection2 = dict([(q,[i[1] for i in sns_d099[q]]) for q in q_list])
min_v2 = min([min(j) for i in self_collection2.values() for j in i])
max_v2 = max([max(j) for i in self_collection2.values() for j in i])
print("At right x abcisses are varying from ", min_v2, " to ", max_v2)
%matplotlib notebook
fig, axs = plt.subplots(4, 2, constrained_layout=True)
axs = axs.ravel()
for j, q in enumerate(q_list[4:]) :
elem = self_collection[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j].plot(np.arange(min_v,max_v,1),
list(map(cum_tail, np.arange(min_v,max_v,1))), label="n="+str(n),
color="black", alpha=0.3 + 0.7*(i/k))
axs[2*j].set_title('q = '+str(q))
n = int(np.mean(list(map(lambda x : new_n(x[0],x[1]), [(n,q)]*99))))+1
#n = int(new_n(n,q))+1
grid = list(range(2*n,3*n))
def bounding(n, t):
return (2*np.exp(3)/9)*((t-n)/2)**(n/2)*np.exp(-(t-n)/2)/gamma((n/2)+1)
axs[2*j].plot(grid, list(map(lambda x : bounding(n,x), grid)), color="red", ls="--", alpha=0.3 + 0.7*(i/k))
axs[2*j].legend(loc="upper right")
def new_n(n, q) :
valeur_prp = np.linalg.eigvals(sn2(generator2(n,q, True, 0.99)))
rhooo = np.mean(np.array(data_d099[(n,q)][:,5]))
new_n = sum([np.real(i)/(np.real(i)+rhooo) for i in valeur_prp])
return new_n
for j, q in enumerate(q_list[4:]) :
elem = self_collection2[q]
for i in range(0,len(elem),1):
n = n_list[i]
grid = np.arange(2*n,3*n,1)
k = len(elem)
def cum(x):
F = np.array(sorted(elem[i]))
return(sum(F<x)/len(F))
def cum_tail(x):
return(1-cum(x))
axs[2*j+1].plot(np.arange(min_v2,max_v2,1),
list(map(cum_tail, np.arange(min_v2,max_v2,1))),
color="black", alpha=0.3 + 0.7*(i/k))
axs[2*j+1].set_title('q = '+str(q))
n = int(np.mean(list(map(lambda x : new_n(x[0],x[1]), [(n,q)]*99))))+1
# n = int(new_n(n,q))+1
grid = list(range(2*n,3*n))
def bounding(n, t):
return (2*np.exp(3)/9)*((t-n)/2)**(n/2)*np.exp(-(t-n)/2)/gamma((n/2)+1)
axs[2*j+1].plot(grid, list(map(lambda x : bounding(n,x), grid)), color="red", label="c= "+str(n), ls="--", alpha=0.3 + 0.7*(i/k))
axs[2*j+1].legend(loc="upper right")
fig.suptitle("Self normalized sums \n Left side : independent case Right side : dependent case (s=0.99)", size=11)
At left, x abcisses are varying from 6.854616603507005 to 182.33652848105416 At right x abcisses are varying from 1.918964882288769 to 132.7074429484273
Text(0.5, 0.98, 'Self normalized sums \n Left side : independent case Right side : dependent case (s=0.99)')
new_n (100,250)
56.42760791938649
for q in q_list[4:5]:
for n in n_list[-4:] :
if n <= q:
dd = list(map(lambda x : new_n(x[0],x[1]), [(n,q)]*10))
plt.hist(dd, label="n="+str(n)+" q="+str(q), color="black", alpha=0.3 + 0.7*(n_list.index(n)/len(n_list)))
plt.axvline(np.mean(dd), color="red", alpha=0.3 + 0.7*(n_list.index(n)/len(n_list)))
plt.show()
[(100,250)]*5
[(100, 250), (100, 250), (100, 250), (100, 250), (100, 250)]
%matplotlib notebook
%matplotlib notebook
fig, axs = plt.subplots(3, 2, constrained_layout=True)
axs = axs.ravel()
axs[0].hist(data_i_d099[list(data_i_d099.keys())[0]][:,1], bins=45, label="q=50", color="orange")
axs[0].axvline(np.mean(data_i_d099[list(data_i_d099.keys())[0]][:,1]), color="orangered", alpha=1)
axs[0].hist(data_i_d099[list(data_i_d099.keys())[3]][:,1], bins=45, label="q=200", color="blue")
axs[0].axvline(np.mean(data_i_d099[list(data_i_d099.keys())[3]][:,1]), alpha=1, color="darkblue", label="mean")
axs[0].hist(data_i_d099[list(data_i_d099.keys())[7]][:,1], bins=45, label="q=400", color="green")
axs[0].axvline(np.mean(data_i_d099[list(data_i_d099.keys())[7]][:,1]), color="olive", alpha=1)
#axs[0].legend(loc="upper right")
axs[2].hist(data_i_d099[list(data_i_d099.keys())[0]][:,1], bins=45, label="q=50", color="orange")
axs[2].hist(data_i_d099[list(data_i_d099.keys())[15]][:,1], bins=45, label="q=100", color='red')
axs[2].hist(data_i_d099[list(data_i_d099.keys())[39]][:,1], bins=45, label="q=200", color="blue")
axs[2].axvline(np.mean(data_i_d099[list(data_i_d099.keys())[0]][:,1]), color="orangered", alpha=1)
axs[2].axvline(np.mean(data_i_d099[list(data_i_d099.keys())[15]][:,1]), color="hotpink", alpha=1)
axs[2].axvline(np.mean(data_i_d099[list(data_i_d099.keys())[39]][:,1]), color="darkblue", alpha=1, label="mean")
#axs[2].legend(loc="upper right")
axs[4].hist(data_i_d099[list(data_i_d099.keys())[1]][:,1], bins=45, label="q=100", color='red')
axs[4].hist(data_i_d099[list(data_i_d099.keys())[17]][:,1], bins=45, label="q=200", color="blue")
axs[4].hist(data_i_d099[list(data_i_d099.keys())[31]][:,1], bins=45, label="q=300", color="gold")
axs[4].hist(data_i_d099[list(data_i_d099.keys())[43]][:,1], bins=45, label="q=400", color="green")
axs[4].axvline(np.mean(data_i_d099[list(data_i_d099.keys())[1]][:,1]), color="hotpink", alpha=1)
axs[4].axvline(np.mean(data_i_d099[list(data_i_d099.keys())[17]][:,1]), color="darkblue", alpha=1, label="mean")
axs[4].axvline(np.mean(data_i_d099[list(data_i_d099.keys())[31]][:,1]), color="coral", alpha=1)
axs[4].axvline(np.mean(data_i_d099[list(data_i_d099.keys())[43]][:,1]), color="olive", alpha=1)
#axs[4].legend(loc="upper right")
axs[1].hist(data_d099[list(data_d099.keys())[0]][:,1], bins=45, label="q=50", color="orange")
axs[1].hist(data_d099[list(data_d099.keys())[3]][:,1], bins=45, label="q=200", color="blue")
axs[1].hist(data_d099[list(data_d099.keys())[7]][:,1], bins=45, label="q=400", color="green")
axs[1].axvline(np.mean(data_d099[list(data_d099.keys())[0]][:,1]), color="orangered", alpha=1)
axs[1].axvline(np.mean(data_d099[list(data_d099.keys())[3]][:,1]), color="darkblue", alpha=1)
axs[1].axvline(np.mean(data_d099[list(data_d099.keys())[7]][:,1]), color="olive", alpha=1)
#axs[1].legend(loc="upper right")
axs[3].hist(data_d099[list(data_d099.keys())[0]][:,1], bins=45, label="q=50", color="orange")
axs[3].hist(data_d099[list(data_d099.keys())[15]][:,1], bins=45, label="q=100", color='red')
axs[3].hist(data_d099[list(data_d099.keys())[39]][:,1], bins=45, label="q=200", color="blue")
axs[3].axvline(np.mean(data_d099[list(data_d099.keys())[0]][:,1]), color="orangered", alpha=1)
axs[3].axvline(np.mean(data_d099[list(data_d099.keys())[15]][:,1]), color="hotpink", alpha=1)
axs[3].axvline(np.mean(data_d099[list(data_d099.keys())[39]][:,1]), color="darkblue", alpha=1, label="mean")
axs[3].legend(loc="upper right")
axs[5].hist(data_d099[list(data_d099.keys())[1]][:,1], bins=45, label="q=100", color='red')
axs[5].hist(data_d099[list(data_d099.keys())[17]][:,1], bins=45, label="q=200", color="blue")
axs[5].hist(data_d099[list(data_d099.keys())[31]][:,1], bins=45, label="q=300", color="gold")
axs[5].hist(data_d099[list(data_d099.keys())[43]][:,1], bins=45, label="q=400", color="green")
axs[5].axvline(np.mean(data_d099[list(data_d099.keys())[1]][:,1]), color="hotpink", alpha=1)
axs[5].axvline(np.mean(data_d099[list(data_d099.keys())[17]][:,1]), color="darkblue", alpha=1, label="mean")
axs[5].axvline(np.mean(data_d099[list(data_d099.keys())[31]][:,1]), color="coral", alpha=1)
axs[5].axvline(np.mean(data_d099[list(data_d099.keys())[43]][:,1]), color="olive", alpha=1)
axs[5].legend(loc="upper right")
#plt.title("rho = dependent case, s=0.6, n=2q")
#handles, labels = axs.get_legend_handles_labels()
#fig.legend(handles, labels, loc='upper center')
# plt.rcParams["figure.figsize"] = (1,1)
plt.show()
plt.rcParams['figure.figsize'] = plt.rcParamsDefault['figure.figsize']
%matplotlib inline
%matplotlib notebook
fig, axs = plt.subplots(3, 2, constrained_layout=True)
axs = axs.ravel()
axs[0].hist(data_i_d06[list(data_i_d06.keys())[0]][:,1], bins=45, label="q=50", color="orange")
axs[0].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[0]][:,1]), color="orangered", alpha=1, label="mean")
axs[0].hist(data_i_d06[list(data_i_d06.keys())[3]][:,1], bins=45, label="q=200", color="blue")
axs[0].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[3]][:,1]), alpha=1, color="darkblue")
axs[0].hist(data_i_d06[list(data_i_d06.keys())[7]][:,1], bins=45, label="q=400", color="green")
axs[0].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[7]][:,1]), color="olive", alpha=1)
#axs[0].legend(loc="upper right")
axs[2].hist(data_i_d06[list(data_i_d06.keys())[0]][:,1], bins=45, label="q=50", color="orange")
axs[2].hist(data_i_d06[list(data_i_d06.keys())[15]][:,1], bins=45, label="q=100", color='red')
axs[2].hist(data_i_d06[list(data_i_d06.keys())[39]][:,1], bins=45, label="q=200", color="blue")
axs[2].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[0]][:,1]), color="orangered", alpha=1, label="mean")
axs[2].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[15]][:,1]), color="hotpink", alpha=1)
axs[2].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[39]][:,1]), color="darkblue", alpha=1)
#axs[2].legend(loc="upper right")
axs[4].hist(data_i_d06[list(data_i_d06.keys())[1]][:,1], bins=45, label="q=100", color='red')
axs[4].hist(data_i_d06[list(data_i_d06.keys())[17]][:,1], bins=45, label="q=200", color="blue")
axs[4].hist(data_i_d06[list(data_i_d06.keys())[31]][:,1], bins=45, label="q=300", color="gold")
axs[4].hist(data_i_d06[list(data_i_d06.keys())[43]][:,1], bins=45, label="q=400", color="green")
axs[4].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[1]][:,1]), color="darkblue", alpha=1, label="mean")
axs[4].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[17]][:,1]), color="darkblue", alpha=1)
axs[4].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[31]][:,1]), color="coral", alpha=1)
axs[4].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[43]][:,1]), color="olive", alpha=1)
#axs[4].legend(loc="upper right")
axs[1].hist(data_d06[list(data_d06.keys())[0]][:,1], bins=45, label="q=50", color="orange")
axs[1].hist(data_d06[list(data_d06.keys())[3]][:,1], bins=45, label="q=200", color="blue")
axs[1].hist(data_d06[list(data_d06.keys())[7]][:,1], bins=45, label="q=400", color="green")
axs[1].axvline(np.mean(data_d06[list(data_d06.keys())[0]][:,1]), color="orangered", alpha=1, label="mean")
axs[1].axvline(np.mean(data_d06[list(data_d06.keys())[3]][:,1]), color="darkblue", alpha=1)
axs[1].axvline(np.mean(data_d06[list(data_d06.keys())[7]][:,1]), color="olive", alpha=1)
#axs[1].legend(loc="upper right")
axs[3].hist(data_d06[list(data_d06.keys())[0]][:,1], bins=45, label="q=50", color="orange")
axs[3].hist(data_d06[list(data_d06.keys())[15]][:,1], bins=45, label="q=100", color='red')
axs[3].hist(data_d06[list(data_d06.keys())[39]][:,1], bins=45, label="q=200", color="blue")
axs[3].axvline(np.mean(data_d06[list(data_d06.keys())[0]][:,1]), color="orangered", alpha=1, label="mean")
axs[3].axvline(np.mean(data_d06[list(data_d06.keys())[15]][:,1]), color="darkblue", alpha=1)
axs[3].axvline(np.mean(data_d06[list(data_d06.keys())[39]][:,1]), color="darkblue", alpha=1)
axs[3].legend(loc="upper right")
axs[5].hist(data_d06[list(data_d06.keys())[1]][:,1], bins=45, label="q=100", color='red')
axs[5].hist(data_d06[list(data_d06.keys())[17]][:,1], bins=45, label="q=200", color="blue")
axs[5].hist(data_d06[list(data_d06.keys())[31]][:,1], bins=45, label="q=300", color="gold")
axs[5].hist(data_d06[list(data_d06.keys())[43]][:,1], bins=45, label="q=400", color="green")
axs[5].axvline(np.mean(data_d06[list(data_d06.keys())[1]][:,1]), color="hotpink", alpha=1, label="mean")
axs[5].axvline(np.mean(data_d06[list(data_d06.keys())[17]][:,1]), color="darkblue", alpha=1)
axs[5].axvline(np.mean(data_d06[list(data_d06.keys())[31]][:,1]), color="coral", alpha=1)
axs[5].axvline(np.mean(data_d06[list(data_d06.keys())[43]][:,1]), color="olive", alpha=1)
axs[5].legend(loc="upper right")
#plt.title("rho = dependent case, s=0.6, n=2q")
#handles, labels = axs.get_legend_handles_labels()
#fig.legend(handles, labels, loc='upper center')
plt.show()
%matplotlib notebook
fig, axs = plt.subplots(3, 2, constrained_layout=True)
axs = axs.ravel()
axs[0].hist(data_i_d06[list(data_i_d06.keys())[0]][:,5], bins=45, label="q=50", color="orange")
axs[0].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[0]][:,5]), color="orangered", alpha=1, label="mean")
axs[0].hist(data_i_d06[list(data_i_d06.keys())[3]][:,5], bins=45, label="q=200", color="blue")
axs[0].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[3]][:,5]), alpha=1, color="darkblue")
axs[0].hist(data_i_d06[list(data_i_d06.keys())[7]][:,5], bins=45, label="q=400", color="green")
axs[0].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[7]][:,5]), color="olive", alpha=1)
#axs[0].legend(loc="upper right")
axs[2].hist(data_i_d06[list(data_i_d06.keys())[0]][:,5], bins=45, label="q=50", color="orange")
axs[2].hist(data_i_d06[list(data_i_d06.keys())[15]][:,5], bins=45, label="q=100", color='red')
axs[2].hist(data_i_d06[list(data_i_d06.keys())[39]][:,5], bins=45, label="q=200", color="blue")
axs[2].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[0]][:,5]), color="orangered", alpha=1, label="mean")
axs[2].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[15]][:,5]), color="hotpink", alpha=1)
axs[2].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[39]][:,5]), color="darkblue", alpha=1)
#axs[2].legend(loc="upper right")
axs[4].hist(data_i_d06[list(data_i_d06.keys())[1]][:,5], bins=45, label="q=100", color='red')
axs[4].hist(data_i_d06[list(data_i_d06.keys())[17]][:,5], bins=45, label="q=200", color="blue")
axs[4].hist(data_i_d06[list(data_i_d06.keys())[31]][:,5], bins=45, label="q=300", color="gold")
axs[4].hist(data_i_d06[list(data_i_d06.keys())[43]][:,5], bins=45, label="q=400", color="green")
axs[4].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[1]][:,5]), color="darkblue", alpha=1, label="mean")
axs[4].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[17]][:,5]), color="darkblue", alpha=1)
axs[4].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[31]][:,5]), color="coral", alpha=1)
axs[4].axvline(np.mean(data_i_d06[list(data_i_d06.keys())[43]][:,5]), color="olive", alpha=1)
#axs[4].legend(loc="upper right")
axs[1].hist(data_d06[list(data_d06.keys())[0]][:,5], bins=45, label="q=50", color="orange")
axs[1].hist(data_d06[list(data_d06.keys())[3]][:,5], bins=45, label="q=200", color="blue")
axs[1].hist(data_d06[list(data_d06.keys())[7]][:,5], bins=45, label="q=400", color="green")
axs[1].axvline(np.mean(data_d06[list(data_d06.keys())[0]][:,5]), color="orangered", alpha=1, label="mean")
axs[1].axvline(np.mean(data_d06[list(data_d06.keys())[3]][:,5]), color="darkblue", alpha=1)
axs[1].axvline(np.mean(data_d06[list(data_d06.keys())[7]][:,5]), color="olive", alpha=1)
#axs[1].legend(loc="upper right")
axs[3].hist(data_d06[list(data_d06.keys())[0]][:,5], bins=45, label="q=50", color="orange")
axs[3].hist(data_d06[list(data_d06.keys())[15]][:,5], bins=45, label="q=100", color='red')
axs[3].hist(data_d06[list(data_d06.keys())[39]][:,5], bins=45, label="q=200", color="blue")
axs[3].axvline(np.mean(data_d06[list(data_d06.keys())[0]][:,5]), color="orangered", alpha=1, label="mean")
axs[3].axvline(np.mean(data_d06[list(data_d06.keys())[15]][:,5]), color="darkblue", alpha=1)
axs[3].axvline(np.mean(data_d06[list(data_d06.keys())[39]][:,5]), color="darkblue", alpha=1)
axs[3].legend(loc="upper right")
axs[5].hist(data_d06[list(data_d06.keys())[1]][:,5], bins=45, label="q=100", color='red')
axs[5].hist(data_d06[list(data_d06.keys())[17]][:,5], bins=45, label="q=200", color="blue")
axs[5].hist(data_d06[list(data_d06.keys())[31]][:,5], bins=45, label="q=300", color="gold")
axs[5].hist(data_d06[list(data_d06.keys())[43]][:,5], bins=45, label="q=400", color="green")
axs[5].axvline(np.mean(data_d06[list(data_d06.keys())[1]][:,5]), color="hotpink", alpha=1, label="mean")
axs[5].axvline(np.mean(data_d06[list(data_d06.keys())[17]][:,5]), color="darkblue", alpha=1)
axs[5].axvline(np.mean(data_d06[list(data_d06.keys())[31]][:,5]), color="coral", alpha=1)
axs[5].axvline(np.mean(data_d06[list(data_d06.keys())[43]][:,5]), color="olive", alpha=1)
axs[5].legend(loc="upper right")
#plt.title("rho = dependent case, s=0.6, n=2q")
#handles, labels = axs.get_legend_handles_labels()
#fig.legend(handles, labels, loc='upper center')
plt.show()
%matplotlib notebook
fig, axs = plt.subplots(3, 2, constrained_layout=True)
axs = axs.ravel()
axs[0].hist(data_i_d099[list(data_i_d099.keys())[0]][:,5], bins=45, label="q=50", color="orange")
axs[0].axvline(np.mean(data_i_d099[list(data_i_d099.keys())[0]][:,5]), color="orangered", alpha=1)
axs[0].hist(data_i_d099[list(data_i_d099.keys())[3]][:,5], bins=45, label="q=200", color="blue")
axs[0].axvline(np.mean(data_i_d099[list(data_i_d099.keys())[3]][:,5]), alpha=1, color="darkblue", label="mean")
axs[0].hist(data_i_d099[list(data_i_d099.keys())[7]][:,5], bins=45, label="q=400", color="green")
axs[0].axvline(np.mean(data_i_d099[list(data_i_d099.keys())[7]][:,5]), color="olive", alpha=1)
#axs[0].legend(loc="upper right")
axs[2].hist(data_i_d099[list(data_i_d099.keys())[0]][:,5], bins=45, label="q=50", color="orange")
axs[2].hist(data_i_d099[list(data_i_d099.keys())[15]][:,5], bins=45, label="q=100", color='red')
axs[2].hist(data_i_d099[list(data_i_d099.keys())[39]][:,5], bins=45, label="q=200", color="blue")
axs[2].axvline(np.mean(data_i_d099[list(data_i_d099.keys())[0]][:,5]), color="orangered", alpha=1)
axs[2].axvline(np.mean(data_i_d099[list(data_i_d099.keys())[15]][:,5]), color="hotpink", alpha=1)
axs[2].axvline(np.mean(data_i_d099[list(data_i_d099.keys())[39]][:,5]), color="darkblue", alpha=1, label="mean")
#axs[2].legend(loc="upper right")
axs[4].hist(data_i_d099[list(data_i_d099.keys())[1]][:,5], bins=45, label="q=100", color='red')
axs[4].hist(data_i_d099[list(data_i_d099.keys())[17]][:,5], bins=45, label="q=200", color="blue")
axs[4].hist(data_i_d099[list(data_i_d099.keys())[31]][:,5], bins=45, label="q=300", color="gold")
axs[4].hist(data_i_d099[list(data_i_d099.keys())[43]][:,5], bins=45, label="q=400", color="green")
axs[4].axvline(np.mean(data_i_d099[list(data_i_d099.keys())[1]][:,5]), color="hotpink", alpha=1)
axs[4].axvline(np.mean(data_i_d099[list(data_i_d099.keys())[17]][:,5]), color="darkblue", alpha=1, label="mean")
axs[4].axvline(np.mean(data_i_d099[list(data_i_d099.keys())[31]][:,5]), color="coral", alpha=1)
axs[4].axvline(np.mean(data_i_d099[list(data_i_d099.keys())[43]][:,5]), color="olive", alpha=1)
#axs[4].legend(loc="upper right")
axs[1].hist(data_d099[list(data_d099.keys())[0]][:,5], bins=45, label="q=50", color="orange")
axs[1].hist(data_d099[list(data_d099.keys())[3]][:,5], bins=45, label="q=200", color="blue")
axs[1].hist(data_d099[list(data_d099.keys())[7]][:,5], bins=45, label="q=400", color="green")
axs[1].axvline(np.mean(data_d099[list(data_d099.keys())[0]][:,5]), color="orangered", alpha=1)
axs[1].axvline(np.mean(data_d099[list(data_d099.keys())[3]][:,5]), color="darkblue", alpha=1)
axs[1].axvline(np.mean(data_d099[list(data_d099.keys())[7]][:,5]), color="olive", alpha=1)
#axs[1].legend(loc="upper right")
axs[3].hist(data_d099[list(data_d099.keys())[0]][:,5], bins=45, label="q=50", color="orange")
axs[3].hist(data_d099[list(data_d099.keys())[15]][:,5], bins=45, label="q=100", color='red')
axs[3].hist(data_d099[list(data_d099.keys())[39]][:,5], bins=45, label="q=200", color="blue")
axs[3].axvline(np.mean(data_d099[list(data_d099.keys())[0]][:,5]), color="orangered", alpha=1)
axs[3].axvline(np.mean(data_d099[list(data_d099.keys())[15]][:,5]), color="hotpink", alpha=1)
axs[3].axvline(np.mean(data_d099[list(data_d099.keys())[39]][:,5]), color="darkblue", alpha=1, label="mean")
axs[3].legend(loc="upper right")
axs[5].hist(data_d099[list(data_d099.keys())[1]][:,5], bins=45, label="q=100", color='red')
axs[5].hist(data_d099[list(data_d099.keys())[17]][:,5], bins=45, label="q=200", color="blue")
axs[5].hist(data_d099[list(data_d099.keys())[31]][:,5], bins=45, label="q=300", color="gold")
axs[5].hist(data_d099[list(data_d099.keys())[43]][:,5], bins=45, label="q=400", color="green")
axs[5].axvline(np.mean(data_d099[list(data_d099.keys())[1]][:,5]), color="hotpink", alpha=1)
axs[5].axvline(np.mean(data_d099[list(data_d099.keys())[17]][:,5]), color="darkblue", alpha=1, label="mean")
axs[5].axvline(np.mean(data_d099[list(data_d099.keys())[31]][:,5]), color="coral", alpha=1)
axs[5].axvline(np.mean(data_d099[list(data_d099.keys())[43]][:,5]), color="olive", alpha=1)
axs[5].legend(loc="upper right")
#plt.title("rho = dependent case, s=0.6, n=2q")
#handles, labels = axs.get_legend_handles_labels()
#fig.legend(handles, labels, loc='upper center')
# plt.rcParams["figure.figsize"] = (1,1)
plt.show()